Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Binary operators a%b and a/b in SSE2

Smart_Lubobya
Beginner
306 Views
Does sse2 use binary operators % and /? how would i write
int x=k%p; //%modulus operator
int y=a/b; // eg 9/4 is equal to 2 and not 2.25 ?
0 Kudos
1 Reply
neni
New Contributor II
306 Views
There are no div or mod on integers in SSE2 (or any SSE extension)
if the numbers are known to have limitedabs value(<2^24), you can convert to float and back to get the div result. mod can be derived from the div result using mul and sub (if you have negative numbers this can be trickier).
if you don't have range limits on the in (assuming 32 bit ints), you need to upconvert to values to doublesand than do 2 doubledivides
0 Kudos
Reply