pup for __int128
authorGengbin Zheng <gzheng@illinois.edu>
Mon, 8 Oct 2012 05:52:22 +0000 (00:52 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Mon, 8 Oct 2012 05:52:22 +0000 (00:52 -0500)
src/util/pup.h
src/util/pup_xlater.C

index 9759cea300ed4f8b2482ecaeb00ed165edce01ff..2745eb719a8ab1931bcfcf2a72c5e1323f7104a1 100644 (file)
@@ -88,6 +88,9 @@ typedef enum {
 //(this list must exactly match that in PUPer_xlate)
   Tchar=0,Tshort, Tint, Tlong, Tlonglong,
   Tuchar,Tushort,Tuint,Tulong, Tulonglong,
+#if CMK___int128_DEFINED
+  Tint128, Tuint128,
+#endif
   Tfloat,Tdouble,Tlongdouble,
   Tbool,
   Tbyte,
@@ -200,6 +203,10 @@ class er {
 #ifdef CMK_PUP_LONG_LONG
   void operator()(CMK_PUP_LONG_LONG &v) {(*this)(&v,1);}
   void operator()(unsigned CMK_PUP_LONG_LONG &v) {(*this)(&v,1);}
+#endif
+#ifdef CMK___int128_DEFINED
+  void operator()(__int128 &v) {(*this)(&v,1);}
+  void operator()(unsigned __int128 &v) {(*this)(&v,1);}
 #endif
   void operator()(void* &v,void* sig) {(*this)(&v,1,sig);}
   
@@ -249,6 +256,12 @@ class er {
   void operator()(unsigned CMK_PUP_LONG_LONG *a,int nItems)
     {bytes((void *)a,nItems,sizeof(unsigned CMK_PUP_LONG_LONG),Tulonglong);}
 #endif
+#ifdef CMK___int128_DEFINED
+  void operator()(__int128 *a,int nItems)
+    {bytes((void *)a,nItems,sizeof(__int128),Tint128);}
+  void operator()(unsigned __int128 *a,int nItems)
+    {bytes((void *)a,nItems,sizeof(unsigned __int128),Tuint128);}
+#endif
 
   //For pointers: the last parameter is to make it more difficult to call
   //(should not be used in normal code as pointers may loose meaning across processor)
@@ -541,7 +554,7 @@ class machineInfo {
   myByte magic[4];//Magic number (to identify machineInfo structs)
   myByte version;//0-- current version
 
-  myByte intBytes[4]; //<- sizeof(char,short,int,long)
+  myByte intBytes[5]; //<- sizeof(char,short,int,long,int128)
   myByte intFormat;//0-- big endian.  1-- little endian.
 
   myByte floatBytes; //<- sizeof(...)
@@ -944,6 +957,10 @@ PUP_BUILTIN_SUPPORT(long double)
 PUP_BUILTIN_SUPPORT(CMK_PUP_LONG_LONG)
 PUP_BUILTIN_SUPPORT(unsigned CMK_PUP_LONG_LONG)
 #endif
+#ifdef CMK___int128_DEFINED
+PUP_BUILTIN_SUPPORT(__int128)
+PUP_BUILTIN_SUPPORT(unsigned __int128)
+#endif
 
 
 //This macro is useful in simple pup routines:
index cdbf213b41866830d1dc3c539d593f9cf18a4218..76d864b117c777d28eedf1be66c016b1e4a300c6 100644 (file)
@@ -95,6 +95,9 @@ const PUP::machineInfo &PUP::machineInfo::current(void)
                m->intBytes[1]=sizeof(short);
                m->intBytes[2]=sizeof(int);
                m->intBytes[3]=sizeof(long);
+#if CMK___int128_DEFINED
+               m->intBytes[4]=sizeof(__int128);
+#endif
                m->intFormat=getIntFormat();
                m->floatBytes=sizeof(float);
                m->doubleBytes=sizeof(double);
@@ -255,6 +258,10 @@ PUP::xlater::xlater(const PUP::machineInfo &src,PUP::er &fromData)
                convertFn[Tlonglong]=convertFn[Tulonglong]=cvt_null;
        else
                convertFn[Tlonglong]=convertFn[Tulonglong]=cvt_swap;
+#if CMK___int128_DEFINED
+       setConverterInt(src,cur,0,4,Tint128);
+       setConverterInt(src,cur,1,4,Tuint128);
+#endif
        convertFn[Tfloat]=converterFloat(src,cur,src.floatBytes,cur.floatBytes);
        convertFn[Tdouble]=converterFloat(src,cur,src.doubleBytes,cur.doubleBytes);
        convertFn[Tlongdouble]=cvt_null; //<- a lie, but no better alternative