IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


static unsigned int GetMsBitIdx ( unsigned int  mask  )  [inline, static]

This inline function uses a single assembly instructions to perform the following while loop. The bit number of the most significant bit set in mask is determined.

    unsigned int msbNum = 0 ;
    unsigned int bitScan = 0x1 << 31 ;
    while (bitScan != 0)
    {
        if ( (bitScan & mask) != 0)
        {
            break ;
        }
        msbNum++ ;
        bitScan >>= 1 ;
    }
    return msbNum ;
Parameters:
mask Bit field whose most significant non-zero bit will be reported.
Returns:
Bit number of most significant 1 bit in mask where the MS bit is bit number zero and LS bit is bit number 31. If mask is zero the return value will be 32.
Compatibility:
This function is not available in the SC1x, SC2x and SC1x3 C-Library.
Since:
SC2x3 n/a - CLIB V1.00





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:36 2017 by Doxygen 1.6.1