SSE2中的运算符%和/ [英] operator % and / in SSE2
本文介绍了SSE2中的运算符%和/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
sse2是否使用二进制运算符%和/?
我怎么写:
Does sse2 use binary operators % and /?
How would i write:
int x=k%p; // eg 9/4 is equal to 1 and not 2.25(modulus operator)
int y=a/b; // eg 9/4 is equal to 2 and not 2.25 ?
推荐答案
可能最好参考 ^ ].
不,SSE2中没有明确的除法或模量指令.您只会得到乘法和移位运算.
如果用常数除,则可以使用幻数"乘以乘法逆.如果不是,则可以尝试使用牛顿方法来找到乘法逆.
这两个链接可能有用:
http://www.gamedev.net/community/forums/topic.asp?topic_id=537139 [^ ]
http://www.hackersdelight.org/divcMore.pdf [
No, there are no explicit division or modulus instructions in SSE2. You only get multiplication and shift operations.
If you are dividing by a constant, you might be able to use "magic numbers" to multiply by the multiplicative inverse. If not, you can try Newton''s method to find the multiplicative inverse.
These two links may be of some use:
http://www.gamedev.net/community/forums/topic.asp?topic_id=537139[^]
http://www.hackersdelight.org/divcMore.pdf[^]
这篇关于SSE2中的运算符%和/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文