sarmfsw: SMFSW Toolbox (for ARM & compatible with Arduino platform) 3.7
SMFSW collection of miscellaneous functions & macros (for ARM & compatible with Arduino platform)
Loading...
Searching...
No Matches
arm_inlines_binary.h File Reference

Binary manipulation inlines. More...

This graph shows which files directly or indirectly include this file:

Functions

DWORD maskBits (const BYTE bits)
 Create specified number of bits mask.
 
BYTE nbBitsState (const DWORD val, const BYTE bits, const BOOL state)
 Check the number of clear/set bits in a variable.
 
SDWORD getMSBitSet (const DWORD val)
 Get power of 2 of the most significant set bit.
 
DWORD swapBits (const DWORD val, const BYTE bits)
 Swap specified number of bits in value (mirroring bits)
 

Detailed Description

Binary manipulation inlines.

Author
SMFSW

Function Documentation

◆ getMSBitSet()

SDWORD getMSBitSet ( const DWORD val)
inline

Get power of 2 of the most significant set bit.

Note
function limited to arm native 32b
Parameters
[in]val- Variable to check for bits
Returns
Power of 2 of most significant bit set
Return values
>=0Index (power of 2) of most significant bit set
-1no bit set

◆ maskBits()

DWORD maskBits ( const BYTE bits)
inline

Create specified number of bits mask.

Note
function limited to arm native 32b
Parameters
[in]bits- Number of bits to create mask
Returns
Mask value for specified number of bits
Here is the caller graph for this function:

◆ nbBitsState()

BYTE nbBitsState ( const DWORD val,
const BYTE bits,
const BOOL state )
inline

Check the number of clear/set bits in a variable.

Note
function limited to arm native 32b
Parameters
[in]val- Variable to check for bits
[in]bits- Number of bits to check
[in]state- Logic state to check
Returns
Number of state specified bits in val

◆ swapBits()

DWORD swapBits ( const DWORD val,
const BYTE bits )
inline

Swap specified number of bits in value (mirroring bits)

Note
function limited to arm native 32b
Parameters
[in]val- Value to swap
[in]bits- Number of bits to swap
Returns
Swapped binary value