Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
include/bits: Fix BIT macro.
Browse files Browse the repository at this point in the history
Fix BIT macro to return a number with only requested bit set.
Renamed existing BIT macro to BIT_GET

Change-Id: I6e1ea5fa99be65950ec3d885579ad8d2b591f102
  • Loading branch information
Shashank Mittal committed Jun 25, 2011
1 parent 2603f13 commit efb6c97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

#define clz(x) __builtin_clz(x)

#define BIT(x, bit) ((x) & (1 << (bit)))
#define BIT(bit) (1 << (bit))
#define BIT_GET(x, bit) ((x) & (1 << (bit)))
#define BIT_SHIFT(x, bit) (((x) >> (bit)) & 1)
#define BITS(x, high, low) ((x) & (((1<<((high)+1))-1) & ~((1<<(low))-1)))
#define BITS_SHIFT(x, high, low) (((x) >> (low)) & ((1<<((high)-(low)+1))-1))
Expand Down

0 comments on commit efb6c97

Please sign in to comment.