When working with IEEE754 floats I've found two ways of zeroing top 9 bits of a 32bit variable. Is any of them better than the other?
Java related addition: is there some list providing information about instruction efficiency? I've randomly found out that BIPUSH is generally supposed to be faster than LDC but not much anything else.
// 10111111110010100011110101110001 bits
// 00000000010010100011110101110001 significand
int bits = 0b10111111110010100011110101110001;
int significand = bits & 0b11111111111111111111111;
int significand2 = bits << 9 >>> 9;
Bytecode…
L4
LINENUMBER 49 L4
ILOAD 0
LDC 8388607 // = 0b11111111111111111111111
IAND
ISTORE 5
L5
LINENUMBER 50 L5
ILOAD 0
BIPUSH 9
ISHL
BIPUSH 9
IUSHR
ISTORE 6
Thanks. :)