BITPlatform Common

Macros

#define SL_CLEAR_BIT (val, mask)   ((val) = ((val) & (~(mask))))
Clear specified bit(s) in a value.
#define SL_IS_ANY_BIT_CLEAR (val, mask)   ((((val) & (mask)) == (mask)) ? (false) : (true))
Determine if any specified bit(s) in a value are clear.
#define SL_IS_ANY_BIT_SET (val, mask)   ((((val) & (mask)) == 0u) ? (false) : (true))
Determine if any specified bit(s) in a value are set.
#define SL_IS_BIT_CLEAR (val, mask)   (((((val) & (mask)) == 0u) && ((mask) != 0u)) ? (true) : (false))
Determine if specified bit(s) in a value are clear.
#define SL_IS_BIT_SET (val, mask)   (((((val) & (mask)) == (mask)) && ((mask) != 0u)) ? (true) : (false))
Determine if specified bit(s) in a value are set.
#define SL_SET_BIT (val, mask)    ((val) = ((val) | (mask)))
Set specified bit(s) in a value.

Macro Definition Documentation

#define SL_CLEAR_BIT ( val,
mask
) ((val) = ((val) & (~(mask))))

Clear specified bit(s) in a value.

SL_CLEAR_BIT()

Parameters
val Value to modify by clearing specified bit(s).
mask Mask of bits to clear.
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'.

Definition at line 63 of file sl_bit.h .

#define SL_IS_ANY_BIT_CLEAR ( val,
mask
) ((((val) & (mask)) == (mask)) ? (false) : (true))

Determine if any specified bit(s) in a value are clear.

SL_IS_ANY_BIT_CLEAR()

Parameters
val Value to check for specified bit(s) clear.
mask Mask of bits to check if clear (see Note #2).
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.

Definition at line 142 of file sl_bit.h .

#define SL_IS_ANY_BIT_SET ( val,
mask
) ((((val) & (mask)) == 0u) ? (false) : (true))

Determine if any specified bit(s) in a value are set.

SL_IS_ANY_BIT_SET()

Parameters
val Value to check for specified bit(s) set.
mask Mask of bits to check if set (see Note #2).
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.

Definition at line 122 of file sl_bit.h .

#define SL_IS_BIT_CLEAR ( val,
mask
) (((((val) & (mask)) == 0u) && ((mask) != 0u)) ? (true) : (false))

Determine if specified bit(s) in a value are clear.

SL_IS_BIT_CLEAR()

Parameters
val Value to check for specified bit(s) clear.
mask Mask of bits to check if 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.

Definition at line 102 of file sl_bit.h .

#define SL_IS_BIT_SET ( val,
mask
) (((((val) & (mask)) == (mask)) && ((mask) != 0u)) ? (true) : (false))

Determine if specified bit(s) in a value are set.

SL_IS_BIT_SET()

Parameters
val Value to check for specified bit(s) set.
mask Mask of bits to check if 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.

Definition at line 83 of file sl_bit.h .

#define SL_SET_BIT ( val,
mask
) ((val) = ((val) | (mask)))

Set specified bit(s) in a value.

SL_SET_BIT()

Parameters
val Value to modify by setting specified bit(s).
mask Mask of bits to set.
Returns
Modified value with specified bit(s) set.
Note
'val' & 'mask' SHOULD be unsigned integers.

Definition at line 45 of file sl_bit.h .