nn::math::ExtractBits Function

Syntax

template <typename T>
T ExtractBits(
     bit32 v,
     int pos,
     int len
);

Template Arguments

Name Description
T Return value type.

Parameters

Name Description
in v Value to operate on.
in pos A position relative to the lowest bit.
in len The bit length of the bit string to be extracted.

Return Values

Returns the extracted bit string.

Description

Extracts the bitstring used to maintain the position.

Extracts the number of bits given by len, starting from the bit given by pos ([pos+len-1,pos]) from the low-order bits of v.

You can also make it so that 0's are created for bits other than those given by len, starting from the bit given by pos from the low-order bits of v.

Revision History

2011/03/01
Initial version.

CONFIDENTIAL