1 #if !defined HAVE_BITSPERLONG_H__ 2 #define HAVE_BITSPERLONG_H__ 3 // This file is part of the FXT library. 4 // Copyright (C) 2010, 2012 Joerg Arndt 5 // License: GNU General Public License version 3 or later, 6 // see the file COPYING.txt in the main directory. 7 8 //#include "bits/bitsperlong.h" // this file 9 10 #if !defined BITS_PER_LONG // could be defined using -DBITS_PER_LONG=value 11 #include <climits> 12 13 #if ( 4294967295UL==ULONG_MAX ) // long is 32bit 14 # define BITS_PER_LONG 32 15 # define LOG2_BITS_PER_LONG 5 16 #else 17 # if ( 18446744073709551615UL==ULONG_MAX ) // long is 64 bit 18 # define BITS_PER_LONG 64 19 # define LOG2_BITS_PER_LONG 6 20 # else 21 # define BITS_PER_LONG 128 // ... assume long is 128 bit 22 # define LOG2_BITS_PER_LONG 7 23 # error 'several functions are not implemented for 128bit long' 24 // contact me and I might fix it 25 # endif // ( 18446744073709551615UL==ULONG_MAX ) 26 #endif // ( 4294967295UL==ULONG_MAX ) 27 28 #endif // !defined BITS_PER_LONG 29 30 31 #define BYTES_PER_LONG (BITS_PER_LONG/8) 32 33 34 35 36 #if !defined BITS_PER_LONG_LONG // could be defined using -DBITS_PER_LONG_LONG=value 37 38 #define BITS_PER_LONG_LONG 64 // default (if ULONG_LONG_MAX is not defined) 39 #define LOG2_BITS_PER_LONG_LONG 6 40 41 //#include <climits> 42 //#ifdef ULONG_LONG_MAX 43 //# if ( 4294967295UL==ULONG_LONG_MAX ) // long long is 32bit, strange ! 44 //# undef BITS_PER_LONG_LONG 45 //# define BITS_PER_LONG_LONG 32 46 //# else // ( 4294967295UL==ULONG_LONG_MAX ) 47 //# if ( 18446744073709551615UL==ULONG_LONG_MAX ) // long long is 64 bit 48 //# undef BITS_PER_LONG_LONG 49 //# define BITS_PER_LONG_LONG 64 50 //# else // ( 18446744073709551615UL==ULONG_LONG_MAX ) 51 //# undef BITS_PER_LONG_LONG 52 //# define BITS_PER_LONG_LONG 128 // ... assume long long is 128 bit 53 //# warning 'some functions might fail for 128bit long long' 54 // contact me and I might fix it 55 //# endif // ( 18446744073709551615UL==ULONG_LONG_MAX ) 56 //# endif // ( 4294967295UL==ULONG_LONG_MAX ) 57 //#endif // def ULONG_LONG_MAX 58 59 #endif // !defined BITS_PER_LONG_LONG 60 61 62 #define BYTES_PER_LONG_LONG (BITS_PER_LONG_LONG/8) 63 64 65 66 #endif // !defined HAVE_BITSPERLONG_H__ 67