Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
ui32_to_f16.c File Reference
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "softfloat.h"
Include dependency graph for ui32_to_f16.c:

Go to the source code of this file.

Functions

float16_t ui32_to_f16 (uint32_t a)
 

Function Documentation

◆ ui32_to_f16()

float16_t ui32_to_f16 ( uint32_t a)

Definition at line 42 of file ui32_to_f16.c.

43{
44 int_fast8_t shiftDist;
45 union ui16_f16 u;
46 uint_fast16_t sig;
47
48 shiftDist = softfloat_countLeadingZeros32( a ) - 21;
49 if ( 0 <= shiftDist ) {
50 u.ui =
51 a ? packToF16UI(
52 0, 0x18 - shiftDist, (uint_fast16_t) a<<shiftDist )
53 : 0;
54 return u.f;
55 } else {
56 shiftDist += 4;
57 sig =
58 (shiftDist < 0)
59 ? a>>(-shiftDist) | ((uint32_t) (a<<(shiftDist & 31)) != 0)
60 : (uint_fast16_t) a<<shiftDist;
61 return softfloat_roundPackToF16( 0, 0x1C - shiftDist, sig );
62 }
63
64}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
float16_t softfloat_roundPackToF16(bool, int_fast16_t, uint_fast16_t)
#define packToF16UI(sign, exp, sig)
Definition internals.h:86
#define softfloat_countLeadingZeros32
unsigned int uint32_t
Definition stdint.h:126
uint16_t uint_fast16_t
Definition stdint.h:155
int8_t int_fast8_t
Definition stdint.h:150
Here is the call graph for this function: