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_var_size.h File Reference

Variables size conversion inlines. More...

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

Functions

BYTE conv16to8Bits (const WORD val)
 convert 16bits variable to 8bits
 
WORD conv8to16Bits (const BYTE val)
 convert 8bits variable to 16bits
 
WORD conv32to16Bits (const DWORD val)
 convert 32bits variable to 16bits
 
DWORD conv16to32Bits (const WORD val)
 convert 16bits variable to 32bits
 
DWORD conv64to32Bits (const LWORD val)
 convert 64bits variable to 32bits
 
LWORD conv32to64Bits (const DWORD val)
 convert 32bits variable to 64bits
 
WORD conv8upto16Bits (const BYTE val, const BYTE nb)
 convert 8bits variable to 8+nb bits (16bits max)
 
DWORD conv16upto32Bits (const WORD val, const BYTE nb)
 convert 16bits variable to 16+nb bits (32bits max)
 
LWORD conv32upto64Bits (const DWORD val, const BYTE nb)
 convert 32bits variable to 32+nb bits (64bits max)
 
DWORD convXtoYBits (const DWORD val, const BYTE from, const BYTE to)
 convert x bits variable to y bits (32bits max)
 
SLWORD scaleValue (const SLWORD val, const SLWORD from_min, const SLWORD from_max, const SLWORD to_min, const SLWORD to_max)
 Scale value from one range to another.
 

Detailed Description

Variables size conversion inlines.

Author
SMFSW

Function Documentation

◆ conv16to32Bits()

DWORD conv16to32Bits ( const WORD val)
inline

convert 16bits variable to 32bits

Parameters
[in]val- 16b value to convert
Returns
Converted value

◆ conv16to8Bits()

BYTE conv16to8Bits ( const WORD val)
inline

convert 16bits variable to 8bits

Parameters
[in]val- 16b value to convert
Returns
Converted value

◆ conv16upto32Bits()

DWORD conv16upto32Bits ( const WORD val,
const BYTE nb )
inline

convert 16bits variable to 16+nb bits (32bits max)

Warning
conversion output shall not exceed 32bits (input shall strictly be unsigned 16bits)
nb shall be in range 0-16 (note that using 0 doesn't change val)
Parameters
[in]val- 16b value to convert
[in]nb- number of bits to add (16bits max)
Returns
Converted value

◆ conv32to16Bits()

WORD conv32to16Bits ( const DWORD val)
inline

convert 32bits variable to 16bits

Parameters
[in]val- 32b value to convert
Returns
Converted value

◆ conv32to64Bits()

LWORD conv32to64Bits ( const DWORD val)
inline

convert 32bits variable to 64bits

Parameters
[in]val- 32b value to convert
Returns
Converted value

◆ conv32upto64Bits()

LWORD conv32upto64Bits ( const DWORD val,
const BYTE nb )
inline

convert 32bits variable to 32+nb bits (64bits max)

Warning
conversion output shall not exceed 64bits (input shall strictly be unsigned 32bits)
nb shall be in range 0-32 (note that using 0 doesn't change val)
Parameters
[in]val- 32b value to convert
[in]nb- number of bits to add (32bits max)
Returns
Converted value

◆ conv64to32Bits()

DWORD conv64to32Bits ( const LWORD val)
inline

convert 64bits variable to 32bits

Parameters
[in]val- 64b value to convert
Returns
Converted value

◆ conv8to16Bits()

WORD conv8to16Bits ( const BYTE val)
inline

convert 8bits variable to 16bits

Parameters
[in]val- 8b value to convert
Returns
Converted value

◆ conv8upto16Bits()

WORD conv8upto16Bits ( const BYTE val,
const BYTE nb )
inline

convert 8bits variable to 8+nb bits (16bits max)

Warning
conversion output shall not exceed 16bits (input shall strictly be unsigned 8bits)
nb shall be in range 0-8 (note that using 0 doesn't change val)
Parameters
[in]val- 8b value to convert
[in]nb- number of bits to add (8bits max)
Returns
Converted value

◆ convXtoYBits()

DWORD convXtoYBits ( const DWORD val,
const BYTE from,
const BYTE to )
inline

convert x bits variable to y bits (32bits max)

Warning
conversion output shall not exceed 32bits (input shall strictly be unsigned 32bits)
nb shall be in range 0-32
Parameters
[in]val- x bits value to convert
[in]from- number of bits from former variable
[in]to- number of bits of output variable
Returns
Converted value
Here is the call graph for this function:

◆ scaleValue()

SLWORD scaleValue ( const SLWORD val,
const SLWORD from_min,
const SLWORD from_max,
const SLWORD to_min,
const SLWORD to_max )
inline

Scale value from one range to another.

Parameters
[in]val- Value to scale
[in]from_min- Minimal input range value
[in]from_max- Maximal input range value
[in]to_min- Minimal output range value
[in]to_max- Maximal output range value