package devkit
Development kit - general purpose library
Install
Dune Dependency
Authors
Maintainers
Sources
devkit-1.20240429.tbz
sha256=222f8ac131b1d970dab7eeb2714bfd6b9338b88b1082e6e01c136ae19e7eaef4
sha512=c9e6d93e3d21e5530c0f4d5baca51bf1f0a5d19248f8af7678d0665bb5cdf295d7aaaaa3e50eb2e44b8720e55097cc675af4dc8ec45acf9da39feb3eae1405d5
doc/src/devkit.core/unsafeBitSet.ml.html
Source file unsafeBitSet.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
open Bigarray module Bytes = Array1 let bget t pos = int_of_char @@ Bytes.unsafe_get t pos let bset t pos c = Bytes.unsafe_set t pos (Char.unsafe_chr c) type t = (char, int8_unsigned_elt, c_layout) Bytes.t let int_size = 7 (* value used to round up index *) let log_int_size = 3 (* number of shifts *) let create n = let size = (n+int_size) lsr log_int_size in let b = Bytes.create Char C_layout size in Bytes.fill b '\x00'; b let copy t = let b = Bytes.create Char C_layout (Bytes.dim t) in Bytes.blit t b; b let set t x = let pos = x lsr log_int_size and delta = x land int_size in bset t pos ((bget t pos) lor (1 lsl delta)) let unset t x = let pos = x lsr log_int_size and delta = x land int_size in bset t pos ((bget t pos) land (0xFF lxor (1 lsl delta))) let toggle t x = let pos = x lsr log_int_size and delta = x land int_size in bset t pos ((bget t pos) lxor (1 lsl delta)) let put t = function | true -> set t | false -> unset t let is_set t x = let pos = x lsr log_int_size and delta = x land int_size in 0 <> (((bget t pos) lsr delta) land 1)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>