[flac-dev] FLAC__BYTES_PER_WORD==8 test results

Cristian Adam cristian.adam at gmail.com
Thu Dec 31 02:43:08 PST 2015


On 31-Dec-15 09:00, Erik de Castro Lopo wrote:
> Brian Willoughby wrote:
>
>> What's wrong with something incredible simple, like:
>>
>> #define FLAC__BYTES_PER_WORD (sizeof(int))
> The fact that it actually is not correct. We want to determine
> the size in bits of the CPU registers.
>
> Here's what I know:
>
>                        sizeof(int)     sizeof (long)
>     ---------------+----------------+-----------------
>     32 bit Linux   |       4        |       4
>     64 bit Linux   |       4        |       8
>     32 bit windows |       4        |       4
>     64 bit windows |       4        |       4
>
> Note that sizeof(long) on 64 bit windows is 4!
>
> Most other unixen follow the LP64 scheme used by Linux.
>
> Erik

On Windows x64 sizeof(long) is 4, but sizeof(ptrdiff_t) is 8.

Any reasons for not using sizeof(ptrdiff_t)?

Cheers,
Cristian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20151231/751f92da/attachment.htm 


More information about the flac-dev mailing list