copysignf
只是位运算吗?
与位运算、分支相比,有没有特别的指令优化?CPU/GPU上有什么差异?
下面这行代码参考了 https://github.com/stdlib-js/math-base-special-copysignf/blob/main/src/main.c
float copysignf(float x, float s) {
uint uabs = floatBitsToUint(x) & 0x7fffffffU;
uint usig = floatBitsToUint(s) & 0x80000000U;
return uintBitsToFloat(uabs | usig);
}