diff --git a/configure.ac b/configure.ac index 21f40f6c..647b5e30 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,7 @@ AC_PROG_RANLIB AC_CHECK_HEADERS(stdint.h) AC_CHECK_HEADERS(malloc/malloc.h) AC_CHECK_HEADERS(malloc.h) +AC_CHECK_HEADERS(endian.h) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T @@ -25,8 +26,6 @@ AC_TYPE_UINT64_T # Checks for library functions. AC_CHECK_FUNCS([gettimeofday]) -AC_CHECK_FUNCS([ntohll]) -AC_CHECK_FUNCS([be64toh]) AC_ARG_ENABLE([simd],[AC_HELP_STRING([--enable-simd=SSE|AVX|AVX2|AVX512],[Select instructions])],[ac_SIMD=${enable_simd}],[ac_SIMD=AVX2]) diff --git a/lib/parallelIO/GridNerscIO.h b/lib/parallelIO/GridNerscIO.h index 51820357..5d1e2e41 100644 --- a/lib/parallelIO/GridNerscIO.h +++ b/lib/parallelIO/GridNerscIO.h @@ -6,7 +6,13 @@ #include #include +#ifdef HAVE_ENDIAN_H +#include #include +#define ntohll be64toh +#else +#include +#endif namespace Grid { @@ -177,14 +183,14 @@ inline void reconstruct3(LorentzColourMatrix & cm) } - void inline be32toh(void *file_object,uint32_t bytes) + void inline be32toh_v(void *file_object,uint32_t bytes) { uint32_t * f = (uint32_t *)file_object; for(int i=0;i*sizeof(uint32_t) &Umu,std::string file,munger munge,int if ( grid->IsBoss() ) { fin.read((char *)&file_object,sizeof(file_object)); - if(ieee32big) be32toh((void *)&file_object,sizeof(file_object)); - if(ieee32) le32toh((void *)&file_object,sizeof(file_object)); - if(ieee64big) be64toh((void *)&file_object,sizeof(file_object)); - if(ieee64) le64toh((void *)&file_object,sizeof(file_object)); + if(ieee32big) be32toh_v((void *)&file_object,sizeof(file_object)); + if(ieee32) le32toh_v((void *)&file_object,sizeof(file_object)); + if(ieee64big) be64toh_v((void *)&file_object,sizeof(file_object)); + if(ieee64) le64toh_v((void *)&file_object,sizeof(file_object)); munge(file_object,munged,csum); }