Nicolas Pomarède schrieb:
On my 64 bit linux, the correct value of interval_fract is 0x5af18
because 0x10000L is defaulting to 64 bit. But with mingw/cygwin for
example, 0x1000L is 32 bit and the operation gets truncated after the
multiplication, yelding a wrong value of interval_fract=0x139c9 :(
It is extremely dangerous to assume certain sizes of the standard C data
types, such as int, long, etc. This is guaranteed to cause portability
problems. For example, even on *64*-bit Windows targets, long has just
32 bits, while it has 64 bits on 64-bit Linux [1]. I would always make
the cast explicit by using int64_t/uint64_t.