Merge pull request #610 from lbetlej/fix_in_set_bits_macro

Fixes for macros used for bit masks creation.
This commit is contained in:
Liam Girdwood 2018-11-22 11:25:42 +00:00 committed by GitHub
commit b0e3dbd5b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -32,9 +32,10 @@
#define __INCLUDE_BIT__
#define BIT(b) (1 << (b))
#define MASK(b_hi, b_lo) ((1 << ((b_hi) - (b_lo) + 1)) - 1)
#define MASK(b_hi, b_lo) \
(((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
#define SET_BIT(b, x) (((x) & 1) << (b))
#define SET_BITS(b_hi, b_lo, x) \
(((x) & ((1 << ((b_hi) - (b_lo) + 1)) - 1)) << (b_lo))
(((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))
#endif