inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_platform 00005 #define inlib_platform 00006 00007 // We do not byteswap on intel (LE) (common platform). 00008 // We have then a better compression on these machines. 00009 // NOTE : this is the contrary to what is done in ROOT (and Rio). 00010 00011 namespace inlib { 00012 00013 inline bool is_little_endian() { 00014 unsigned int i = 1; 00015 unsigned char* b = (unsigned char*)&i; 00016 // BE = Big Endian, LE = Little Endian. 00017 // The Intels x86 are LE. 00018 // Mac PPC b[3] is 1 (BE) 00019 // Mac Intel b[0] is 1 (LE) 00020 // Linux i386 b[0] is 1 (LE) 00021 // Linux x86_64 b[0] is 1 (LE) 00022 return (b[0]==1?true:false); 00023 } 00024 00025 } 00026 00027 #endif 00028