MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / rtne_shift32

Function rtne_shift32

Source/astcenc_mathlib_softfloat.cpp:59–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59static uint32_t rtne_shift32(uint32_t inp, uint32_t shamt)
60{
61 uint32_t vl1 = UINT32_C(1) << shamt;
62 uint32_t inp2 = inp + (vl1 >> 1); /* added 0.5 ULP */
63 uint32_t msk = (inp | UINT32_C(1)) & vl1; /* nonzero if odd. '| 1' forces it to 1 if the shamt is 0. */
64 msk--; /* negative if even, nonnegative if odd. */
65 inp2 -= (msk >> 31); /* subtract epsilon before shift if even. */
66 inp2 >>= shamt;
67 return inp2;
68}
69
70static uint32_t rtna_shift32(uint32_t inp, uint32_t shamt)
71{

Callers 1

sf32_to_sf16Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected