Skip to content

Commit 7baece6

Browse files
committed
Use uintptr_t
uintptr_t is part of the C standard (<stdint.h>), so it works on all major platforms, including Linux, macOS, and Windows, for both 32-bit and 64-bit architectures. On 32-bit systems, uintptr_t is a 32-bit unsigned integer. On 64-bit systems, uintptr_t is a 64-bit unsigned integer. It’s specifically designed for storing pointer values as integers safely, so any pointer-to-integer or integer-to-pointer cast using uintptr_t is portable and safe, unlike using unsigned int, which can break on 64-bit systems.
1 parent 566ed82 commit 7baece6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/romimg/src/romimg.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
#define __ROMING_H__
2222

2323
#include "dprintf.h"
24-
#if defined(_WIN32) || defined(WIN32)
25-
#define RMIMG_PTRCAST unsigned int
26-
#else
27-
#define RMIMG_PTRCAST unsigned char *
28-
#endif
24+
#include <stdint.h> // for uintptr_t
25+
26+
#define RMIMG_PTRCAST uintptr_t
27+
2928
struct RomDirEntry
3029
{
3130
char name[10];

0 commit comments

Comments
 (0)