[Gridflow-cvs] [svn] commit: r6082 - /trunk/src/gridflow.hxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Fri Aug 13 15:24:32 EDT 2010


Author: matju
Date: Fri Aug 13 15:24:26 2010
New Revision: 6082

Log:
allow many initializer-types for t_atom2; and add default n=1 in COPY,CLEAR,memswap

Modified:
    trunk/src/gridflow.hxx

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Fri Aug 13 15:24:26 2010
@@ -276,6 +276,8 @@
 #undef TYPECASTER2
 
 	template <class T> t_atom2 &operator = (T value) {set_atom(this,value); return *this;};
+	template <class T> t_atom2             (T value) {set_atom(this,value);              };
+	t_atom2 () {}
 };
 
 template <class T> T convert(const t_atom &x, T *foo) {const t_atom2 *xx = (const t_atom2 *)&x; return (T)*xx;}
@@ -313,9 +315,9 @@
 };
 
 void gfmemcopy(uint8 *out, const uint8 *in, long n);
-template <class T> inline void COPY  (T *dest, const T *src, long n) {gfmemcopy((uint8*)dest,(const uint8*)src,n*sizeof(T));}
-template <class T> inline void CLEAR (T *dest,               long n) {memset(dest,0,n*sizeof(T));}
-template <class T> static void memswap (T *a,  T *b,         long n) {T c[n]; COPY(c,a,n); COPY(a,b,n); COPY(b,c,n);}
+template <class T> inline void COPY  (T *dest, const T *src, long n=1) {gfmemcopy((uint8*)dest,(const uint8*)src,n*sizeof(T));}
+template <class T> inline void CLEAR (T *dest,               long n=1) {memset(dest,0,n*sizeof(T));}
+template <class T> static void memswap (T *a,  T *b,         long n=1) {T c[n]; COPY(c,a,n); COPY(a,b,n); COPY(b,c,n);}
 
 //****************************************************************
 



More information about the Gridflow-cvs mailing list