You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose some API for things like getting the most/least significant bit index, along with getting the number of set bits in an int.
My main purpose here is to explore how well OCaml works for bitboards, which represent a chessboard as a 64-bit int, with each bit representing the presence/absence of a piece.
This requires a large amount of bit twiddling, for example to serialise given bitboards into moves.
Extracting the MSB/LSB can be done in OCaml purely through your library, but it would benefit heavily from the hardware acceleration of C compiler intrinsics that OCaml doesn't provide.
The text was updated successfully, but these errors were encountered:
I would expect using nativeint for this purpose would yield the best results; unfortunately for you, it is only 63 bit wide. Implementing the bit twiddling in C (on an int64) means, that you have to call a C function, which has a little overhead. I suspect that you CPU caches will equalize the difference between a getLSB FFI call and a Int64.(&&) 0x1L (or whatever).
(Sorry, I accidentally hit enter)
I'd like to propose some API for things like getting the most/least significant bit index, along with getting the number of set bits in an int.
My main purpose here is to explore how well OCaml works for bitboards, which represent a chessboard as a 64-bit int, with each bit representing the presence/absence of a piece.
This requires a large amount of bit twiddling, for example to serialise given bitboards into moves.
Extracting the MSB/LSB can be done in OCaml purely through your library, but it would benefit heavily from the hardware acceleration of C compiler intrinsics that OCaml doesn't provide.
The text was updated successfully, but these errors were encountered: