Mike - EMAIL IGNORED wrote: > On FC4 with g++ (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8): > > unsigned long long int mask = 0x003fffffffffffff; > const uint64_t mask = 0x003fffffffffffff; > const uint64_t mask = static_cast<uint64_t>(0x003fffffffffffff); > > all result in: > > error: integer constant is too large for 'long' type > > I workaround with: > > const uint64_t mask = (0x003fffff << 32) | 0xffffffff; > > Is this as expected?
The workaround may not work as expected. The expected result of (0x003fffff << 32) is int(0). > Is it fixed in a later version? You could use a suffix for your long constant as you know already, or use a portable macro from <stdint.h> /* Unsigned. */ # define UINT8_C(c) c # define UINT16_C(c) c # define UINT32_C(c) c ## U # if __WORDSIZE == 64 # define UINT64_C(c) c ## UL # else # define UINT64_C(c) c ## ULL # endif http://www.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html#tag_13_48_03_04 _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus