> obvious that it's not going to use the popcnt opcode instruction ... I'd guess totally impossible in Java
I don't understand why you would guess at what Java can do when you can find out for certain?
public class Test {
private static int bitCount(int a) {
return Integer.bitCount(a);
}
public static void main(String[] args) {
while (true) {
bitCount(14);
}
}
}
I don't understand why you would guess at what Java can do when you can find out for certain?
Compiles bitCount to There's your popcnt instruction. No need to guess.