package devkit
Development kit - general purpose library
Install
Dune Dependency
Authors
Maintainers
Sources
devkit-1.20210120.tbz
md5=47338eaae436aba40abd4d194ee40054
sha256=499b050b73643f6ad7349a41485539d4166d149a07fba59cb6841f508c0297f8
sha512=6a5bf77061d390ddb331ed3d5891a5c56502be91f0eff6846202f658ebfa97ef57695d7a192cbdad4c7b8835f5665df3ea4375daf46930334ebbd9a07f00feca
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)"
>