Fix 32-bit portability issues in NIF code#3
Merged
martinsumner merged 1 commit intoOpenRiak:openriak-3.4from Feb 23, 2026
Merged
Fix 32-bit portability issues in NIF code#3martinsumner merged 1 commit intoOpenRiak:openriak-3.4from
martinsumner merged 1 commit intoOpenRiak:openriak-3.4from
Conversation
Contributor
lemenkov
commented
Feb 12, 2026
- 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:
- Use correct type for enif_get_ulong() - it expects unsigned long*, not size_t*, which may differ on some platforms.
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>
Contributor
|
@aef- would you be able to provide a review for this? Seems fine to me, but I don't have a background in C. |
aef-
approved these changes
Feb 22, 2026
Member
|
lgtm -- thanks for the PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.