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