Bit Manipulation#

Bitwise operations.

Macros#

#define
SL_SET_BIT (val, mask)

Set specified bit(s) in a value.

#define
SL_CLEAR_BIT (val, mask)

Clear specified bit(s) in a value.

#define
SL_IS_BIT_SET (val, mask)

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

#define
SL_IS_BIT_CLEAR (val, mask)

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

#define
SL_IS_ANY_BIT_SET (val, mask)

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

#define

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

#define

Determine if a value is a power of 2.

Macro Definition Documentation#

SL_SET_BIT#

#define SL_SET_BIT
Value:
(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.


Definition at line 54 of file platform/common/inc/sl_bit.h

SL_CLEAR_BIT#

#define SL_CLEAR_BIT
Value:
(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'.


Definition at line 72 of file platform/common/inc/sl_bit.h

SL_IS_BIT_SET#

#define SL_IS_BIT_SET
Value:
(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.


Definition at line 92 of file platform/common/inc/sl_bit.h

SL_IS_BIT_CLEAR#

#define SL_IS_BIT_CLEAR
Value:
(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.


Definition at line 111 of file platform/common/inc/sl_bit.h

SL_IS_ANY_BIT_SET#

#define SL_IS_ANY_BIT_SET
Value:
(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.


Definition at line 131 of file platform/common/inc/sl_bit.h

SL_IS_ANY_BIT_CLEAR#

#define SL_IS_ANY_BIT_CLEAR
Value:
(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.


Definition at line 151 of file platform/common/inc/sl_bit.h

SL_MATH_IS_PWR2#

#define SL_MATH_IS_PWR2
Value:
(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.


Definition at line 164 of file platform/common/inc/sl_bit.h