search for: sizeof_voidp

Displaying 5 results from an estimated 5 matches for "sizeof_voidp".

2015 Dec 28
6
How to check for 64-bit CPU?
...optimal for both 16- and 24-bit input */ #else if(mean <= 0x80000000/8) { /* 32-bit arch: use 32-bit math if possible */ #endif A) How to properly check for 64-bit architectures? I can check for "defined FLAC__CPU_X86_64" or "defined _WIN64". Is it possible to use SIZEOF_VOIDP? such as "#if SIZEOF_VOIDP == 8" ? B) Does it make sense to put the following code into some header file? (if yes, what header file should be used?) #if (defined FLAC__CPU_X86_64) || ...something else here... #define FLAC__64BIT_ARCH 1 #else #undef FLAC__64BIT_ARCH #endif
2007 Jun 13
2
Patch : Fix pointer cast warning
Josh Coalson wrote: > excellent, thanks for the tip. this solves the problem for > autoconf-based builds, but still not sure how to do it for MSVC. Sorry, whats the problem with MSVC? Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Microsoft's biggest weakness is
2015 Dec 30
3
How to check for 64-bit CPU?
On 29 December 2015 at 08:08, Erik de Castro Lopo <mle+la at mega-nerd.com> wrote: > I would suggest: > > #if SIZEOF_VOIDP == 8 I believe this is not portable. At least on my machine ("4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)") it's not defined. Probably this one comes closest: #define __SIZEOF_POINTER__ 8 Riggs
2015 Dec 29
2
How to check for 64-bit CPU?
...;> if(mean <= 0x80000000/8) { /* 32-bit arch: use 32-bit math if possible */ >> #endif >> >> A) How to properly check for 64-bit architectures? >> I can check for "defined FLAC__CPU_X86_64" or "defined _WIN64". >> Is it possible to use SIZEOF_VOIDP? such as "#if SIZEOF_VOIDP == 8" ? > > That would need a special case for Linux x32 which is x86_64 with 32 > bits pointers ... and this probably won't be the last time we'd need to handle special cases. Do we really need to handle this at all? Entangling CPU-arch-depend...
2007 Apr 15
2
Patch : Fix pointer cast warning
...this right for all archs */ - if(sizeof(void*) == sizeof(unsigned)) - *aligned_address = (void*)(((unsigned)x + 31) & -32); - else if(sizeof(void*) == sizeof(FLAC__uint64)) - *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32))); - else - return 0; +#if SIZEOF_VOIDP == 4 + increment = ((unsigned) (32 - (((unsigned) x) & 31))) & 31; +#elif SIZEOF_VOIDP == 8 + increment = ((unsigned) (32 - (((FLAC__uint64) x) & 31))) & 31; +#else +#endif + *aligned_address = (void *) (x + increment); #else x = malloc(bytes); - *aligned_address = x; + *aligned_...