#include #include /* middle of the road */ #define V (1ULL<<31) void main() { uvlong i; uvlong v; vlong s, e; v = V; s = nsec(); for(i = 0; i < 10000000; i++){ if(v & 1) while(v & 1) v = (v >> 1) | (1ULL<<63); while(!(v & 1)) v >>= 1; } e = nsec(); print("normal way: %lldms\n", (e-s)/1000000); v = V; s = nsec(); for(i = 0; i < 10000000; i++){ if(v & 1){ v = ~v; v = ~(v/(v & -v)); } v /= (v & -v); } e = nsec(); print("other way: %lldms\n", (e-s)/1000000); }