How does this function compute the absolute value of a float through a NOT and AND operation?

佐手、 提交于 2019-12-01 18:00:26

-0.0 is represented as 1000...0001. Therefore _mm_andnot_ps(-0.0, x)2 is equivalent to 0111...111 & x. This forces the MSB (which is the sign bit) to 0.


1. In IEEE-754, at least.

2. The _mm_andnot_ps intrinsic does not mean "NAND"; see e.g. http://msdn.microsoft.com/en-us/library/68h7wd02(v=vs.90).aspx.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!