标签:space struct col tac turn nbsp using oat pac
参考https://stackoverflow.com/questions/3026441/float32-to-float16
#include <cstdio> #include <cstdint> using namespace std; using float16_t = uint16_t; struct Float16 { float16_t _value; Float16(float16_t value) { _value = value; } Float16(float value) { uint32_t m = *(uint32_t *)&value; _value = ((m & 0x7fffffff) >> 13) - (0x38000000 >> 13); _value |= ((m & 0x80000000) >> 16); } operator float16_t () { return _value; } operator float () { uint32_t m = _value; m = ((m & 0x7fff) << 13) + 0x38000000; m |= ((_value & 0x8000) << 16); return *(float *)&m; } };
标签:space struct col tac turn nbsp using oat pac
原文地址:https://www.cnblogs.com/JebediahKerman/p/12732941.html