On Dec 30, 2015, at 3:09 AM, Thomas Zander <thomas.e.zander at googlemail.com> wrote:> On 29 December 2015 at 21:50, lvqcl <lvqcl.mail at gmail.com> wrote: >> So, does it make sense to #define FLAC__BYTES_PER_WORD (in bitreader.c) >> as 4 for 32-bit and as 8 for 64-bit targets? > > Your tests so far imply this is a sensible default. > I'd say go ahead. We can always change it if it turns out there is a > better option. > > RiggsWhat's wrong with something incredible simple, like: #define FLAC__BYTES_PER_WORD (sizeof(int)) ?
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 -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
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. > > ErikOn 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