{"action":"created","issue":{"url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/30","repository_url":"https://api.github.com/repos/andrenth/ocaml-stdint","labels_url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/30/comments","events_url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/30/events","html_url":"https://github.com/andrenth/ocaml-stdint/issues/30","id":334959998,"node_id":"MDU6SXNzdWUzMzQ5NTk5OTg=","number":30,"title":"[RFC] Bit twiddling API","user":{"login":"ZirconiumX","id":1503707,"node_id":"MDQ6VXNlcjE1MDM3MDc=","avatar_url":"https://avatars2.githubusercontent.com/u/1503707?v=4","gravatar_id":"","url":"https://api.github.com/users/ZirconiumX","html_url":"https://github.com/ZirconiumX","followers_url":"https://api.github.com/users/ZirconiumX/followers","following_url":"https://api.github.com/users/ZirconiumX/following{/other_user}","gists_url":"https://api.github.com/users/ZirconiumX/gists{/gist_id}","starred_url":"https://api.github.com/users/ZirconiumX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZirconiumX/subscriptions","organizations_url":"https://api.github.com/users/ZirconiumX/orgs","repos_url":"https://api.github.com/users/ZirconiumX/repos","events_url":"https://api.github.com/users/ZirconiumX/events{/privacy}","received_events_url":"https://api.github.com/users/ZirconiumX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-22T17:30:53Z","updated_at":"2018-09-19T11:47:23Z","closed_at":null,"author_association":"NONE","body":"(Sorry, I accidentally hit enter)\r\n\r\nI'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.\r\n\r\nMy main purpose here is to explore how well OCaml works for [bitboards](http://chessprogramming.wikispaces.com/Bitboards), which represent a chessboard as a 64-bit int, with each bit representing the presence/absence of a piece.\r\n\r\nThis requires a large amount of bit twiddling, for example to serialise given bitboards into moves.\r\n\r\nExtracting 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."},"comment":{"url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/comments/422770720","html_url":"https://github.com/andrenth/ocaml-stdint/issues/30#issuecomment-422770720","issue_url":"https://api.github.com/repos/andrenth/ocaml-stdint/issues/30","id":422770720,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjc3MDcyMA==","user":{"login":"mwweissmann","id":11030828,"node_id":"MDQ6VXNlcjExMDMwODI4","avatar_url":"https://avatars3.githubusercontent.com/u/11030828?v=4","gravatar_id":"","url":"https://api.github.com/users/mwweissmann","html_url":"https://github.com/mwweissmann","followers_url":"https://api.github.com/users/mwweissmann/followers","following_url":"https://api.github.com/users/mwweissmann/following{/other_user}","gists_url":"https://api.github.com/users/mwweissmann/gists{/gist_id}","starred_url":"https://api.github.com/users/mwweissmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwweissmann/subscriptions","organizations_url":"https://api.github.com/users/mwweissmann/orgs","repos_url":"https://api.github.com/users/mwweissmann/repos","events_url":"https://api.github.com/users/mwweissmann/events{/privacy}","received_events_url":"https://api.github.com/users/mwweissmann/received_events","type":"User","site_admin":false},"created_at":"2018-09-19T11:47:23Z","updated_at":"2018-09-19T11:47:23Z","author_association":"COLLABORATOR","body":"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)."}}
{"actor":{"display_login":"mwweissmann"}}