Skip to content

Commit

Permalink
libosdp/utils/include/utils/utils.h:31: warning: "BIT" redefined
Browse files Browse the repository at this point in the history
Using gcc 8.4.0 throws this warning:

libosdp/utils/include/utils/utils.h:31: warning: "BIT" redefined
 #define BIT(n)                         (1ull << (n))

It's safe to conditionally define this
  • Loading branch information
badevos committed Nov 6, 2023
1 parent f20502e commit 7a6b573
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#define BYTE_2(x) (uint8_t)(((x) >> 16) & 0xFF)
#define BYTE_3(x) (uint8_t)(((x) >> 24) & 0xFF)

#ifndef BIT
#define BIT(n) (1ull << (n))
#endif
#define MASK(n) (BIT((n) + 1) - 1)
#define BIT_IS_SET(m, n) (bool)((m) & BIT(n))
#define BIT_SET(m, n) ((m) |= BIT(n))
Expand Down

0 comments on commit 7a6b573

Please sign in to comment.