From 5441a7dd1c54876692e25679396c95ee5b40e042 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Fri, 10 Feb 2023 11:05:07 +0800 Subject: [PATCH] added half2u16/half2u8 --- inc/hgl/math/HalfFloat.h | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/inc/hgl/math/HalfFloat.h b/inc/hgl/math/HalfFloat.h index e771cda..f6c3aa7 100644 --- a/inc/hgl/math/HalfFloat.h +++ b/inc/hgl/math/HalfFloat.h @@ -2,6 +2,7 @@ #define HGL_HALF_FLOAT_INCLUDE #include +#include namespace hgl { @@ -143,6 +144,44 @@ namespace hgl ++target; ++source; } - } + } + + inline void half2u16(uint16 *output,const half_float *input,const uint count) + { + union + { + float f; + uint32 u; + }x; + + for(uint i=0;i