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

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


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.

Regards
Christian

[1]
<https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152417>
--
Christian Zietz  -  CHZ-Soft  -  czietz@xxxxxxx
WWW: http://www.chzsoft.de/
PGP/GnuPG-Key-ID: 0x52CB97F66DA025CA / 0x6DA025CA



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