package devkit
Development kit - general purpose library
Install
Dune Dependency
Authors
Maintainers
Sources
devkit-1.3.tbz
sha256=dae965685dceed47ad8e9844f12fe707dafdf2c3bdd46d0431d5b4d1e7754b23
sha512=b94ade804d751db87434042bbaa821fa8e82e233820a76806f910e2da040094b137e88a3579911a1626930912622b064c776ddbcb6991fb7111021ebf6553fdc
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)"
>