oboy/src/bit.ml

5 lines
101 B
OCaml

let is_set num i =
if i < 0 then failwith "Invalid bit index."
(num lsr i) land 0b00000001 <> 0