Re: [hatari-devel] STe DMA sound -> new downsampling method

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 05/10/2019 à 11:47, Christian Zietz a écrit :
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.


note that in my case it was not an assumption on purpose, it was just that it worked and I didn't pay attention to the possible cast error :)




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/