-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PW_SID:844767] [1/4] util: Remove confusing static keyword use #67
base: workflow
Are you sure you want to change the base?
Conversation
'__n' is declared as static const which is confusing since it would imply that __n is only initialized once. This works out in the end since the macro used in a separate anonymous block, but some compilers (i.e. clang) will generate a symbol table entry for '__n'. This is not needed since the expression is always constant. Declare '__n' as a const size_t instead since that is the type produced by the sizeof() operation used by L_ARRAY_SIZE. While here, also declare '__i' as size_t to match '__n'. Fixes: 4a9f638 ("util: Add L_IN_SET macros")
These macros support arbitrarily sized bitmaps using any integer data type. It is thus possible to write code like this: uint64_t bitmap = 0; uint8_t array[4] = {}; bool r; L_BIT_SET(&bitmap, 63); r = L_BIT_TEST(&bitmap, 0); L_BIT_SET(array, 25); r = L_BIT_TEST(array, 31);
These macros can set or clear an arbitrary number of bits in a single call, as follows: uint64_t bitmap = 0; L_BITS_CLEAR(&bitmap, 0, 1, 5, 15, 32, 63);
Fetch PR GitLint Output:
Make Distcheck Output:
Build - Configure Output:
Make Check Output:
Make Check w/Valgrind Output:
Incremental Build with patches Output:
Autotest Runner Output:
Clang Build Output:
|
Fetch PR GitLint Output:
Prep - Setup ELL Output:
Make Distcheck Output:
Build - Configure Output:
Make Check Output:
Make Check w/Valgrind Output:
Incremental Build with patches Output:
Autotest Runner Output:
Clang Build Output:
|
62cb485
to
57c8d67
Compare
57c8d67
to
d078c9c
Compare
d078c9c
to
a96766e
Compare
70750ab
to
108b545
Compare
cf9aae3
to
d96cbc5
Compare
d96cbc5
to
a575883
Compare
ae6045c
to
a70fe95
Compare
a70fe95
to
8ded230
Compare
b70a423
to
f7b1d76
Compare
3164ee9
to
1f782ea
Compare
c181123
to
8f71769
Compare
'__n' is declared as static const which is confusing since it
would imply that __n is only initialized once. This works out in the
end since the macro used in a separate anonymous block, but some compilers
(i.e. clang) will generate a symbol table entry for '__n'. This is not
needed since the expression is always constant.
Declare '__n' as a const size_t instead since that is the type produced
by the sizeof() operation used by L_ARRAY_SIZE.
While here, also declare '__i' as size_t to match '__n'.
Fixes: 4a9f638 ("util: Add L_IN_SET macros")
ell/util.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)