VLC 4.0.0-dev
Collaboration diagram for Bit operations:

Macros

#define VLC_INT_FUNC(basename)
 
#define VLC_INT_FUNC_TYPE(basename, type, suffix)
 
#define VLC_INT_GENERIC(func, x)
 
#define clz(x)
 Count leading zeroes. More...
 
#define ctz(x)   VLC_INT_GENERIC(vlc_ctz, x)
 Count trailing zeroes. More...
 
#define parity(x)   VLC_INT_GENERIC(vlc_parity, x)
 Parity. More...
 
#define vlc_popcount(x)
 Bit weight / population count. More...
 

Functions

static int vlc_clzll (unsigned long long x)
 
static int vlc_clzl (unsigned long x)
 
static int vlc_clz (unsigned x)
 
static int vlc_ctz_generic (unsigned long long x)
 
static int vlc_parity_generic (unsigned long long x)
 
static int vlc_popcount_generic (unsigned long long x)
 
static int vlc_ctz (unsigned x)
 
static int vlc_ctzl (unsigned long x)
 
static int vlc_ctzll (unsigned long long x)
 
static int vlc_parity (unsigned x)
 
static int vlc_parityl (unsigned long x)
 
static int vlc_parityll (unsigned long long x)
 
static int vlc_popcount (unsigned x)
 
static int vlc_popcountl (unsigned long x)
 
static int vlc_popcountll (unsigned long long x)
 
static uint16_t vlc_bswap16 (uint16_t x)
 Byte swap (16 bits) More...
 
static uint32_t vlc_bswap32 (uint32_t x)
 Byte swap (32 bits) More...
 
static uint64_t vlc_bswap64 (uint64_t x)
 Byte swap (64 bits) More...
 

Detailed Description

Macro Definition Documentation

◆ clz

#define clz (   x)
Value:
_Generic((x), \
unsigned char: (vlc_clz(x) - (sizeof (unsigned) - 1) * 8), \
unsigned short: (vlc_clz(x) \
- (sizeof (unsigned) - sizeof (unsigned short)) * 8), \
unsigned: vlc_clz(x), \
unsigned long: vlc_clzl(x), \
unsigned long long: vlc_clzll(x))
static int vlc_clzll(unsigned long long x)
Definition: vlc_common.h:637
static int vlc_clzl(unsigned long x)
Definition: vlc_common.h:649
static int vlc_clz(unsigned x)
Definition: vlc_common.h:654

Count leading zeroes.

This function counts the number of consecutive zero (clear) bits down from the highest order bit in an unsigned integer.

Parameters
xa non-zero integer
Note
This macro assumes that CHAR_BIT equals 8.
Warning
By definition, the result depends on the (width of the) type of x.
Returns
The number of leading zero bits in x.

◆ ctz

#define ctz (   x)    VLC_INT_GENERIC(vlc_ctz, x)

Count trailing zeroes.

This function counts the number of consecutive zero bits up from the lowest order bit in an unsigned integer.

Parameters
xa non-zero integer
Note
This function assumes that CHAR_BIT equals 8.
Returns
The number of trailing zero bits in x.

◆ parity

#define parity (   x)    VLC_INT_GENERIC(vlc_parity, x)

Parity.

This function determines the parity of an integer.

Return values
0if x has an even number of set bits.
1if x has an odd number of set bits.

◆ VLC_INT_FUNC

#define VLC_INT_FUNC (   basename)
Value:
VLC_INT_FUNC_TYPE(basename, unsigned, ) \
VLC_INT_FUNC_TYPE(basename, unsigned long, l) \
VLC_INT_FUNC_TYPE(basename, unsigned long long, ll)
#define VLC_INT_FUNC_TYPE(basename, type, suffix)
Definition: vlc_common.h:689

◆ VLC_INT_FUNC_TYPE

#define VLC_INT_FUNC_TYPE (   basename,
  type,
  suffix 
)
Value:
VLC_USED static inline int vlc_##basename##suffix(type x) \
{ \
return vlc_##basename##_generic(x); \
}
#define VLC_USED
Definition: vlc_common.h:163

◆ VLC_INT_GENERIC

#define VLC_INT_GENERIC (   func,
 
)
Value:
_Generic((x), \
unsigned char: func(x), \
signed char: func(x), \
unsigned short: func(x), \
signed short: func(x), \
unsigned int: func(x), \
signed int: func(x), \
unsigned long: func##l(x), \
signed long: func##l(x), \
unsigned long long: func##ll(x), \
signed long long: func##ll(x))

◆ vlc_popcount

#define vlc_popcount (   x)
Value:
_Generic((x), \
signed char: vlc_popcount((unsigned char)(x)), \
signed short: vlc_popcount((unsigned short)(x)), \
#define VLC_INT_GENERIC(func, x)
Definition: vlc_common.h:699
#define vlc_popcount(x)
Bit weight / population count.
Definition: vlc_common.h:760

Bit weight / population count.

This function counts the number of non-zero bits in an integer.

Returns
The count of non-zero bits.

Function Documentation

◆ vlc_bswap16()

static uint16_t vlc_bswap16 ( uint16_t  x)
inlinestatic

Byte swap (16 bits)

Referenced by GetWLE(), and SetWLE().

◆ vlc_bswap32()

static uint32_t vlc_bswap32 ( uint32_t  x)
inlinestatic

Byte swap (32 bits)

Referenced by GetDWLE(), and SetDWLE().

◆ vlc_bswap64()

static uint64_t vlc_bswap64 ( uint64_t  x)
inlinestatic

Byte swap (64 bits)

Referenced by GetQWLE(), and SetQWLE().

◆ vlc_clz()

static int vlc_clz ( unsigned  x)
inlinestatic

References vlc_clzll().

◆ vlc_clzl()

static int vlc_clzl ( unsigned long  x)
inlinestatic

References vlc_clzll().

◆ vlc_clzll()

static int vlc_clzll ( unsigned long long  x)
inlinestatic

Referenced by vlc_clz(), and vlc_clzl().

◆ vlc_ctz()

static int vlc_ctz ( unsigned  x)
inlinestatic

◆ vlc_ctz_generic()

static int vlc_ctz_generic ( unsigned long long  x)
inlinestatic

◆ vlc_ctzl()

static int vlc_ctzl ( unsigned long  x)
inlinestatic

◆ vlc_ctzll()

static int vlc_ctzll ( unsigned long long  x)
inlinestatic

◆ vlc_parity()

static int vlc_parity ( unsigned  x)
inlinestatic

◆ vlc_parity_generic()

static int vlc_parity_generic ( unsigned long long  x)
inlinestatic

◆ vlc_parityl()

static int vlc_parityl ( unsigned long  x)
inlinestatic

◆ vlc_parityll()

static int vlc_parityll ( unsigned long long  x)
inlinestatic

◆ vlc_popcount()

static int vlc_popcount ( unsigned  x)
inlinestatic

◆ vlc_popcount_generic()

static int vlc_popcount_generic ( unsigned long long  x)
inlinestatic

References count.

◆ vlc_popcountl()

static int vlc_popcountl ( unsigned long  x)
inlinestatic

◆ vlc_popcountll()

static int vlc_popcountll ( unsigned long long  x)
inlinestatic