comparison src/share/vm/utilities/globalDefinitions.hpp @ 145:f3de1255b035

6603011: RFE: Optimize long division Summary: Transform long division by constant into multiply Reviewed-by: never, kvn
author rasbold
date Wed, 07 May 2008 08:06:46 -0700
parents ba764ed4b6f2
children d1605aabd0a1 12eea04c8b06
comparison
equal deleted inserted replaced
132:60b728ec77c1 145:f3de1255b035
888 while (p != 0 && p <= (julong)x) { 888 while (p != 0 && p <= (julong)x) {
889 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 889 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
890 i++; p *= 2; 890 i++; p *= 2;
891 } 891 }
892 // p = 2^(i+1) && x < p (i.e., 2^i <= x < 2^(i+1)) 892 // p = 2^(i+1) && x < p (i.e., 2^i <= x < 2^(i+1))
893 // (if p = 0 then overflow occured and i = 31) 893 // (if p = 0 then overflow occured and i = 63)
894 return i; 894 return i;
895 } 895 }
896 896
897 //* the argument must be exactly a power of 2 897 //* the argument must be exactly a power of 2
898 inline int exact_log2(intptr_t x) { 898 inline int exact_log2(intptr_t x) {