Skip to content

Commit c3db256

Browse files
ktrzcinxlgirdwood
authored andcommitted
bit: Upgrade BIT macro to use 1UL instead of 1
In such a solution it is possible to assign BIT(31) to uint32_t register value without any warning. Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
1 parent c41aa4e commit c3db256

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/include/sof/bit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
#ifndef __SOF_BIT_H__
99
#define __SOF_BIT_H__
1010

11+
#if ASSEMBLY
1112
#define BIT(b) (1 << (b))
13+
#else
14+
#define BIT(b) (1UL << (b))
15+
#endif
16+
1217
#define MASK(b_hi, b_lo) \
1318
(((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
1419
#define SET_BIT(b, x) (((x) & 1) << (b))

0 commit comments

Comments
 (0)