【发布时间】:2020-09-12 16:08:03
【问题描述】:
这更像是对https://stackoverflow.com/a/5587983/13586005 的跟进。 @sam hocevar 或其他任何了解这一点的人:您介意解释一下这里发生的事情吗:
tmp = (tmp - 0x70) & ((unsigned int)((int)(0x70 - tmp) >> 4) >> 27);
我不确定我是否完全遵循它。我知道(tmp - 0x70) 正在纠正 127->15 偏差,但我不理解第二部分((unsigned int)((int)(0x70 - tmp) >> 4) >> 27),因此不理解最后一步中修正偏差的 &。谢谢!
【问题讨论】:
标签: c++ c floating-point bit-manipulation half-precision-float