21 #ifndef AVUTIL_SOFTFLOAT_IEEE754_H 22 #define AVUTIL_SOFTFLOAT_IEEE754_H 42 while( sf.
mant >= 0x1000000UL ) {
46 sf.
mant &= 0x007fffffUL;
67 return ((
SoftFloat_IEEE754) { (n & 0x80000000UL) >> 31, (n & 0x7FFFFFUL), (int8_t)((n & 0x7F800000UL) >> 23)});
85 mant = ((((uint64_t) (a.
mant | 0x00800000UL)) <<
MANT_BITS) / (b.
mant| 0x00800000UL));
98 mant = (((uint64_t)(a.
mant|0x00800000UL) * (uint64_t)(b.
mant|0x00800000UL))>>
MANT_BITS);
111 if (a.
exp != b.
exp )
return 0;
static SoftFloat_IEEE754 av_normalize_sf_ieee754(SoftFloat_IEEE754 sf)
Normalize the softfloat as defined by IEEE 754 single-recision floating point specification.
static int av_sf2int_ieee754(SoftFloat_IEEE754 a)
Convert the softfloat to integer.
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 SoftFloat_IEEE754 av_bits2sf_ieee754(uint32_t n)
Make a softfloat out of the bitstream.
static SoftFloat_IEEE754 av_int2sf_ieee754(int64_t n, int e)
Convert integer to softfloat.
static int av_cmp_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b)
Compare a with b strictly.
static const SoftFloat_IEEE754 FLOAT_1
static const SoftFloat_IEEE754 FLOAT_0
static SoftFloat_IEEE754 av_mul_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b)
Multiply a with b return normalized result.
static SoftFloat_IEEE754 av_div_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b)
Divide a by b.