Displaying 4 results from an estimated 4 matches for "__sizeof_pointer__".
2015 Dec 30
3
How to check for 64-bit CPU?
...;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
2014 Feb 22
2
[PATCH] efi: off-by-one in gdt allocation
...t *)0 };
+struct dt_desc gdt = { 0x7ff, (uint64_t *)0 };
struct dt_desc idt = { 0, 0 };
static inline EFI_MEMORY_DESCRIPTOR *
@@ -852,12 +852,12 @@ static int build_gdt(void)
EFI_STATUS status;
/* Allocate gdt consistent with the alignment for architecture */
- status = emalloc(gdt.limit, __SIZEOF_POINTER__ , (EFI_PHYSICAL_ADDRESS *)&gdt.base);
+ status = emalloc(gdt.limit + 1, __SIZEOF_POINTER__ , (EFI_PHYSICAL_ADDRESS *)&gdt.base);
if (status != EFI_SUCCESS) {
printf("Failed to allocate memory for GDT, bailing out\n");
return -1;
}
- memset(gdt.base, 0x0, gdt.limit);
+ me...
2020 Mar 24
2
[PATCH] efi/main.c: include <efisetjmp.h>
...longjmp(&load_error_buf, 1);
| ^~~~~~~
syslinux/efi/main.c: In function ?build_gdt?:
syslinux/efi/main.c:907:75: warning: taking address of packed member of ?struct dt_desc? may result in an unaligned pointer value [-Waddress-of-packed-member]
907 | status = emalloc(gdt.limit, __SIZEOF_POINTER__ , (EFI_PHYSICAL_ADDRESS *)&gdt.base);
| ^~~~~~~~~
syslinux/efi/main.c: In function ?efi_main?:
syslinux/efi/main.c:1390:7: warning: implicit declaration of function ?setjmp? [-Wimplicit-function-declaration]
1390 |...
2015 Dec 28
6
How to check for 64-bit CPU?
In stream_encoder.c there's the following code:
#if defined FLAC__CPU_X86_64 /* and other 64-bit arch, too */
if(mean <= 0x80000000/512) { /* 512: more or less 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