comparison src/share/vm/utilities/globalDefinitions.hpp @ 9044:bb44c0e88235

8214206: Fix for JDK-8213419 is broken on 32-bit Reviewed-by: mdoerr, shade
author roland
date Wed, 06 Feb 2019 11:41:51 +0100
parents 67aa2bb0d84e
children 71bd8f8ad1fb
comparison
equal deleted inserted replaced
76:71f71934476b 77:5758b6b01f6d
1147 // (if p = 0 then overflow occurred and i = 31) 1147 // (if p = 0 then overflow occurred and i = 31)
1148 return i; 1148 return i;
1149 } 1149 }
1150 1150
1151 //* largest i such that 2^i <= x 1151 //* largest i such that 2^i <= x
1152 // A negative value of 'x' will return '63' 1152 inline int log2_long(julong x) {
1153 inline int log2_long(unsigned long x) {
1154 int i = -1; 1153 int i = -1;
1155 julong p = 1; 1154 julong p = 1;
1156 while (p != 0 && p <= x) { 1155 while (p != 0 && p <= x) {
1157 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 1156 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
1158 i++; p *= 2; 1157 i++; p *= 2;
1164 1163
1165 inline int log2_intptr(intptr_t x) { 1164 inline int log2_intptr(intptr_t x) {
1166 return log2_intptr((uintptr_t)x); 1165 return log2_intptr((uintptr_t)x);
1167 } 1166 }
1168 1167
1169 inline int log2_intptr(int x) { 1168 inline int log2_int(int x) {
1170 return log2_intptr((uintptr_t)x); 1169 return log2_intptr((uintptr_t)x);
1171 } 1170 }
1172 1171
1173 inline int log2_intptr(uint x) { 1172 inline int log2_jint(jint x) {
1174 return log2_intptr((uintptr_t)x); 1173 return log2_intptr((uintptr_t)x);
1175 } 1174 }
1176 1175
1177 inline int log2_long(jlong x) { 1176 inline int log2_uint(uint x) {
1178 return log2_long((unsigned long)x); 1177 return log2_intptr((uintptr_t)x);
1178 }
1179
1180 // A negative value of 'x' will return '63'
1181 inline int log2_jlong(jlong x) {
1182 return log2_long((julong)x);
1179 } 1183 }
1180 1184
1181 //* the argument must be exactly a power of 2 1185 //* the argument must be exactly a power of 2
1182 inline int exact_log2(intptr_t x) { 1186 inline int exact_log2(intptr_t x) {
1183 #ifdef ASSERT 1187 #ifdef ASSERT