Go to the documentation of this file.
19 #ifndef AVUTIL_RISCV_INTMATH_H
20 #define AVUTIL_RISCV_INTMATH_H
31 #define av_clip_int8 av_clip_int8_rvi
34 union { uint8_t
u; int8_t
s; }
u = { .u =
a };
37 a = ((
a >> 31) ^ 0x7F);
41 #define av_clip_int16 av_clip_int16_rvi
44 union { uint16_t
u; int16_t
s; }
u = { .u =
a };
47 a = ((
a >> 31) ^ 0x7FFF);
51 #define av_clipl_int32 av_clipl_int32_rvi
57 a = ((
a >> 63) ^ 0x7FFFFFFF);
61 #define av_clip_intp2 av_clip_intp2_rvi
64 const int shift = 31 - p;
68 b = (
a >> 31) ^ ((1 << p) - 1);
72 #if defined (__GNUC__) || defined (__clang__)
73 #define av_popcount __builtin_popcount
74 #if (__riscv_xlen >= 64)
75 #define av_popcount64 __builtin_popcountl
77 #define av_popcount64 __builtin_popcountll
#define u(width, name, range_min, range_max)
static av_always_inline av_const int32_t av_clipl_int32_rvi(int64_t a)
static av_always_inline av_const int8_t av_clip_int8_rvi(int a)
static int shift(int a, int b)
static av_always_inline av_const int av_clip_intp2_rvi(int a, int p)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static av_always_inline av_const int16_t av_clip_int16_rvi(int a)