9 #define SS (sizeof(int) * CHAR_BIT - 1) 11 static inline unsigned int bitMask(
unsigned int bitCount)
14 return (1U << bitCount) - 1;
21 return (
unsigned int) (v) >>
SS;
28 return (v1 ^ v2) >>
SS;
35 return (~s & v0) | (s & v1);
42 return max + ((v - max) & ((v - max) >>
SS));
49 return min - ((min - v) & ((min - v) >>
SS));
56 return v & (-v >>
SS);
70 return v & (-v0 >>
SS);
77 return (v + (v >>
SS)) ^ (v >>
SS);
81 static inline unsigned int bsr(
unsigned int w)
85 return __builtin_clz(w) ^
SS;
89 static inline unsigned int numBits(
unsigned int v)
97 static inline unsigned int s2u(
int s)
100 return (s << 1) ^ (s >>
SS);
104 static inline int u2s(
unsigned int u)
107 return (u >> 1) ^ (-(u & 1));
static unsigned int numBits(unsigned int v)
static int selectVal(int s, int v0, int v1)
static int u2s(unsigned int u)
static unsigned int absValue(int v)
static unsigned int signBit(int v)
static unsigned int bsr(unsigned int w)
static int cancelValue(int v, int v0)
static int clampByte(int v)
static int clampMin(int v, int min)
static unsigned int bitMask(unsigned int bitCount)
static int oppositeSign(int v1, int v2)
static int clampMax(int v, int max)
static unsigned int s2u(int s)