X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fhalf_float.h;h=01557424735db11d3f3f1f923a629a49456510db;hb=209692c7168b5bf4f4034862e2af3ccfc79f6257;hp=64f2042101857f4b6560446a43337ece72ee7666;hpb=958fc04dc51a2561c8598f42df59e3d9139e56a7;p=mesa.git diff --git a/src/util/half_float.h b/src/util/half_float.h index 64f20421018..01557424735 100644 --- a/src/util/half_float.h +++ b/src/util/half_float.h @@ -25,14 +25,27 @@ #ifndef _HALF_FLOAT_H_ #define _HALF_FLOAT_H_ +#include #include #ifdef __cplusplus extern "C" { #endif +#define FP16_ONE 0x3C00 +#define FP16_ZERO 0 + uint16_t _mesa_float_to_half(float val); float _mesa_half_to_float(uint16_t val); +uint8_t _mesa_half_to_unorm8(uint16_t v); +uint16_t _mesa_uint16_div_64k_to_half(uint16_t v); + +static inline bool +_mesa_half_is_negative(uint16_t h) +{ + return !!(h & 0x8000); +} + #ifdef __cplusplus } /* extern C */