Hi all,
Can this code snippet be converted to Java?
u64 magic_table[24] = {
0x1000000010000000ull,
0x1000000000010000ull,
0x1000000000000001ull,
0x0100000001000000ull,
0x0100000000010000ull,
0x0100000000000010ull,
0x0010000000100000ull,
0x0010000000010000ull,
0x0010000000000100ull,
0x0001000010000000ull,
0x0001000001000000ull,
0x0001000000100000ull,
0x0000100000000100ull,
0x0000100000000010ull,
0x0000100000000001ull,
0x0000010000100000ull,
0x0000010000001000ull,
0x0000010000000100ull,
0x0000001001000000ull,
0x0000001000001000ull,
0x0000001000000010ull,
0x0000000110000000ull,
0x0000000100001000ull,
0x0000000100000001ull
};
u64 test(u64 magic_sum, int square) {
u64 before = magic_sum & 0x4444444444444444ull;
u64 afte = (magic_sum + magic_table[square]) & 0x4444444444444444ull;
return after & ~before;
}