Commit 43bda99
committed
Fix 32-bit portability issues in NIF code
1. Use uintptr_t instead of uint64_t for pointer tagging macros
(IS_ENTRY_LIST, GET_ENTRY_LIST_POINTER, MAKE_ENTRY_LIST_POINTER).
Fixes warnings on 32-bit:
```
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -mtls-dialect=gnu -c -I/usr/lib/erlang/usr/include c_src/bitcask_nifs.c -o c_src/bitcask_nifs.o
c_src/bitcask_nifs.c: In function ‘keydir_entry_hash’:
c_src/bitcask_nifs.c:190:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
190 | #define IS_ENTRY_LIST(p) ((uint64_t)p&1)
| ^
```
2. Use correct type for enif_get_ulong() - it expects unsigned long*,
not size_t*, which may differ on some platforms.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Assisted-by: Claude (Anthropic) <https://claude.ai>1 parent 8c12bc5 commit 43bda99
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
2494 | 2494 | | |
2495 | 2495 | | |
2496 | 2496 | | |
2497 | | - | |
| 2497 | + | |
2498 | 2498 | | |
2499 | 2499 | | |
2500 | | - | |
| 2500 | + | |
2501 | 2501 | | |
2502 | 2502 | | |
| 2503 | + | |
2503 | 2504 | | |
2504 | 2505 | | |
2505 | 2506 | | |
| |||
0 commit comments