Function GetLastBit

Summary

#include <include/EASTL/bitset.h>

(1) uint32_t GetLastBit(uint8_t x)

(2) uint32_t GetLastBit(uint16_t x)

(3) uint32_t GetLastBit(uint32_t x)

(4) uint32_t GetLastBit(uint64_t x)

Function overload

Synopsis

#include <include/EASTL/bitset.h>

uint32_t GetLastBit(uint8_t x)

Description

No description yet.

Source

Lines 572-586 in include/EASTL/bitset.h.

inline uint32_t GetLastBit(uint8_t x)
{
    if(x)
    {
        uint32_t n = 0;
        if(x & 0xFFF0) { n +=  4; x >>=  4; }
        if(x & 0xFFFC) { n +=  2; x >>=  2; }
        if(x & 0xFFFE) { n +=  1;           }
        return n;
    }
    return 8;
}

Synopsis

#include <include/EASTL/bitset.h>

uint32_t GetLastBit(uint16_t x)

Description

No description yet.

Source

Lines 588-603 in include/EASTL/bitset.h.

inline uint32_t GetLastBit(uint16_t x)
{
    if(x)
    {
        uint32_t n = 0;
        if(x & 0xFF00) { n +=  8; x >>=  8; }
        if(x & 0xFFF0) { n +=  4; x >>=  4; }
        if(x & 0xFFFC) { n +=  2; x >>=  2; }
        if(x & 0xFFFE) { n +=  1;           }
        return n;
    }
    return 16;
}

Synopsis

#include <include/EASTL/bitset.h>

uint32_t GetLastBit(uint32_t x)

Description

No description yet.

Source

Lines 605-621 in include/EASTL/bitset.h.

inline uint32_t GetLastBit(uint32_t x)
{
    if(x)
    {
        uint32_t n = 0;
        if(x & 0xFFFF0000) { n += 16; x >>= 16; }
        if(x & 0xFFFFFF00) { n +=  8; x >>=  8; }
        if(x & 0xFFFFFFF0) { n +=  4; x >>=  4; }
        if(x & 0xFFFFFFFC) { n +=  2; x >>=  2; }
        if(x & 0xFFFFFFFE) { n +=  1;           }
        return n;
    }
    return 32;
}

Synopsis

#include <include/EASTL/bitset.h>

uint32_t GetLastBit(uint64_t x)

Description

No description yet.

Source

Lines 623-640 in include/EASTL/bitset.h.

inline uint32_t GetLastBit(uint64_t x)
{
    if(x)
    {
        uint32_t n = 0;
        if(x & UINT64_C(0xFFFFFFFF00000000)) { n += 32; x >>= 32; }
        if(x & 0xFFFF0000)                   { n += 16; x >>= 16; }
        if(x & 0xFFFFFF00)                   { n +=  8; x >>=  8; }
        if(x & 0xFFFFFFF0)                   { n +=  4; x >>=  4; }
        if(x & 0xFFFFFFFC)                   { n +=  2; x >>=  2; }
        if(x & 0xFFFFFFFE)                   { n +=  1;           }
        return n;
    }
    return 64;
}





Add Discussion as Guest

Log in