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