package multicore-magic
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Low-level multicore utilities for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
multicore-magic-2.3.2.tbz
sha256=8d8d70a823aae1ce0430380842aa881c4ac838d245caf27ed0ff25775087175f
sha512=9379322c92fcdf28d285c6671dae634ad5b87e086572b00485cbfcd8e3046c130db63c749190168ebc7e12f3739ae2f7ba7bb6227fd1d8fb055a29f84b6e379f
doc/src/multicore-magic/padding.ml.html
Source file padding.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 42 43 44 45 46 47let num_padding_words = if Sys.backend_type == Native || Sys.backend_type == Bytecode then Cache.words_per_cache_line - 1 else (* Disables padding on special targets like js_of_ocaml. *) 0 let copy_as_padded (o : 'a) : 'a = if num_padding_words = 0 then o else let o = Obj.repr o in if Obj.is_block o then begin let original_size = Obj.size o in let padded_size = if original_size <= num_padding_words then num_padding_words else original_size + num_padding_words in if original_size <> padded_size then begin let t = Obj.tag o in if Sys.word_size = 64 && t != Obj.double_array_tag then begin let n = Obj.new_block t padded_size in Array.blit (Obj.obj o) 0 (Obj.obj n) 0 original_size; Obj.obj n end else Obj.obj o end else Obj.obj o end else Obj.obj o let copy_as ?padded x = if num_padding_words = 0 then x else match padded with None | Some false -> x | Some true -> copy_as_padded x let make_padded_array n x = let a = Array.make (n + num_padding_words) x in if num_padding_words <> 0 && Obj.is_block (Obj.repr x) then Array.fill a n num_padding_words (if Obj.tag (Obj.repr x) == Obj.double_tag then Obj.magic 0.0 else Obj.magic ()); a let[@inline] length_of_padded_array x = Array.length x - num_padding_words let[@inline] length_of_padded_array_minus_1 x = Array.length x - (num_padding_words + 1)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>