tree-wide: replace FLAGS_SET(..., 1 << v) with BIT_SET(..., v)

This commit is contained in:
Mike Yuan
2024-12-28 15:08:00 +01:00
parent 382f3438d9
commit 1e4e557262
23 changed files with 77 additions and 60 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
#include <string.h>
#include "alloc-util.h"
#include "bitfield.h"
#include "capability-util.h"
#include "cap-list.h"
#include "extract-word.h"
@@ -83,7 +84,7 @@ int capability_set_to_string(uint64_t set, char **ret) {
for (unsigned i = 0; i <= cap_last_cap(); i++) {
const char *p;
if (!FLAGS_SET(set, UINT64_C(1) << i))
if (!BIT_SET(set, i))
continue;
p = CAPABILITY_TO_STRING(i);
@@ -143,7 +144,7 @@ int capability_set_to_strv(uint64_t set, char ***ret) {
for (unsigned i = 0; i <= cap_last_cap(); i++) {
const char *p;
if (!FLAGS_SET(set, UINT64_C(1) << i))
if (!BIT_SET(set, i))
continue;
p = CAPABILITY_TO_STRING(i);
+5 -1
View File
@@ -18,6 +18,7 @@
#endif
#include "alloc-util.h"
#include "bitfield.h"
#include "compress.h"
#include "fd-util.h"
#include "fileio.h"
@@ -124,7 +125,10 @@ bool compression_supported(Compression c) {
(1U << COMPRESSION_LZ4) * HAVE_LZ4 |
(1U << COMPRESSION_ZSTD) * HAVE_ZSTD;
return c >= 0 && c < _COMPRESSION_MAX && FLAGS_SET(supported, 1U << c);
assert(c >= 0);
assert(c < _COMPRESSION_MAX);
return BIT_SET(supported, c);
}
#if HAVE_XZ