package rfsm
A toolset for describing and simulating StateChart-like state diagrams
Install
Dune Dependency
Authors
Maintainers
Sources
rfsm-v1.6-alpha-3.tbz
sha256=eb9583d2a7e354f00f4e0f6b2ea34f2825c92a15a21b708e03fa72c570104ab6
sha512=baff3194770f85efc55e813bbf5e515e1d0d4fae44c492fc6c15ba4834cc41fae5ecb842de1b1fdea10bafe19b4b72320b829d862aeefc6d58845270d8b3088f
doc/src/rfsm/intbits.ml.html
Source file intbits.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
(**********************************************************************) (* *) (* This file is part of the RFSM package *) (* *) (* Copyright (c) 2018-present, Jocelyn SEROT. All rights reserved. *) (* *) (* This source code is licensed under the license found in the *) (* LICENSE file in the root directory of this source tree. *) (* *) (**********************************************************************) exception Invalid_range of int * int let get_bits hi lo n = (n lsr lo) mod (1 lsl (hi-lo+1)) let set_bits hi lo n v = let v' = v mod (1 lsl (hi-lo+1)) in let msk = let r = ref 0 in for i=lo to hi do r := !r lor (1 lsl i) done; !r in (n land (lnot msk)) lor (v' lsl lo) let to_string s n = let b = Bytes.create s in let rec h n i = if i>=0 then begin Bytes.set b i (if n mod 2 = 1 then '1' else '0'); h (n/2) (i-1) end in h n (s-1); Bytes.to_string b let rec bit_size n = if n=0 then 0 else 1 + bit_size (n/2)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>