Bit Manipulation#
Bitwise operations.
Macros#
Create bit mask with single, specified bit set.
Set specified bit(s) in a value.
Clear specified bit(s) in a value.
Determine whether the specified bit(s) in a value are set.
Determine whether the specified bit(s) in a value are clear.
Determine whether any specified bit(s) in a value are set.
Determine whether any specified bit(s) in a value are clear.
Determine if a value is a power of 2.
Macro Definition Documentation#
SL_DEF_BIT#
#define SL_DEF_BITValue:
(bit)
Create bit mask with single, specified bit set.
SL_DEF_BIT()
Returns
Bit mask with single, specified bit set.
Note
(1) 'bit' SHOULD be a non-negative integer.
(2) 'bit' values that overflow the target CPU &/or compiler environment (e.g. negative or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors.
55
of file platform/common/inc/sl_bit.h
SL_SET_BIT#
#define SL_SET_BITValue:
(val, mask)
Set specified bit(s) in a value.
SL_SET_BIT()
Returns
Modified value with specified bit(s) set.
Note
'val' & 'mask' SHOULD be unsigned integers.
71
of file platform/common/inc/sl_bit.h
SL_CLEAR_BIT#
#define SL_CLEAR_BITValue:
(val, mask)
Clear specified bit(s) in a value.
SL_CLEAR_BIT()
Returns
Modified value with specified bit(s) clear.
Note
'val' & 'mask' SHOULD be unsigned integers.
'mask' SHOULD be cast with the same data type than 'val'.
89
of file platform/common/inc/sl_bit.h
SL_IS_BIT_SET#
#define SL_IS_BIT_SETValue:
(val, mask)
Determine whether the specified bit(s) in a value are set.
SL_IS_BIT_SET()
Returns
true, if ALL specified bit(s) are set in value.
false, if ALL specified bit(s) are NOT set in value.
Note
'val' & 'mask' SHOULD be unsigned integers.
NULL 'mask' allowed; returns 'false' since NO mask bits specified.
109
of file platform/common/inc/sl_bit.h
SL_IS_BIT_CLEAR#
#define SL_IS_BIT_CLEARValue:
(val, mask)
Determine whether the specified bit(s) in a value are clear.
SL_IS_BIT_CLEAR()
Returns
true, if ALL specified bit(s) are clear in value.
false, if ALL specified bit(s) are NOT clear in value.
Note
val' & 'mask' SHOULD be unsigned integers.
NULL 'mask' allowed; returns 'false' since NO mask bits specified.
128
of file platform/common/inc/sl_bit.h
SL_IS_ANY_BIT_SET#
#define SL_IS_ANY_BIT_SETValue:
(val, mask)
Determine whether any specified bit(s) in a value are set.
SL_IS_ANY_BIT_SET()
Returns
true, if ANY specified bit(s) are set in value.
false, if ALL specified bit(s) are NOT set in value.
Note
'val' & 'mask' SHOULD be unsigned integers.
NULL 'mask' allowed; returns 'false' since NO mask bits specified.
148
of file platform/common/inc/sl_bit.h
SL_IS_ANY_BIT_CLEAR#
#define SL_IS_ANY_BIT_CLEARValue:
(val, mask)
Determine whether any specified bit(s) in a value are clear.
SL_IS_ANY_BIT_CLEAR()
Returns
true, if ANY specified bit(s) are clear in value.
false, if ALL specified bit(s) are NOT clear in value.
Note
'val' & 'mask' SHOULD be unsigned integers.
NULL 'mask' allowed; returns 'false' since NO mask bits specified.
168
of file platform/common/inc/sl_bit.h
SL_MATH_IS_PWR2#
#define SL_MATH_IS_PWR2Value:
(val)
Determine if a value is a power of 2.
SL_MATH_IS_PWR2()
Returns
true, 'val' is a power of 2. false, 'val' is not a power of 2.
181
of file platform/common/inc/sl_bit.h