View Single Post
Old 07-22-2009, 12:45 PM   #3
liteon
Human being with feelings
 
liteon's Avatar
 
Join Date: Apr 2008
Posts: 510
Default fast integer conversations

fast fractional to integer conversation for negative or positive input (x):

floor:
Code:
x|=0;
ceil:
Code:
x+=0.9999999999999999*sign(x);
x|=0;
round:
Code:
x+=0.5*sign(x);
x|=0;

---
lubomir

Last edited by liteon; 07-25-2009 at 04:15 AM.
liteon is offline   Reply With Quote