package libmojave
Build not checked sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
General-purpose OCaml library from the MetaPRL and OMake projects
Install
dune-project
Dependency
Authors
Maintainers
Sources
1.0.0.tar.gz
sha256=71069caac3b30160383df372858467bb43b93012509e218cc19cd87dd8142603
sha512=f66bf137d69b62f0548be5d5702bf96915fcea4b43762710cd1eea1a3956fc082672ad9e68485b2f58ee14c133063a70bf8f5df1d0de38aa1bab07605dc675e5
doc/src/libmojave/lm_bitmatrix.ml.html
Source file lm_bitmatrix.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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96# 1 "util/lm_bitmatrix.ml" (* * Adjacency matrix. * Implement this with bitwise operations. * * ---------------------------------------------------------------- * * @begin[license] * Copyright (C) 2001-2005 Mojave Group, Caltech * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Additional permission is given to link this library with the * OpenSSL project's "OpenSSL" library, and with the OCaml runtime, * and you may distribute the linked executables. See the file * LICENSE.libmojave for more details. * * Author: Jason Hickey * @email{jyh@cs.caltech.edu} * @end[license] *) (* * Raw bits. *) type t = bytes array (* * Characters are 8 bits wide. *) let byte_shift = 3 let byte_size = 1 lsl byte_shift let byte_mask = pred byte_size let roundup i = (i + byte_mask) land (lnot byte_mask) (* * Create a new matrix. *) let create w h = let len = (roundup w) lsr byte_shift in Array.init h (fun _ -> Bytes.make len '\000') (* * Test if an edge exists. *) let query m i j = let s = m.(i) in let j_byte = j lsr byte_shift in let j_bit = j land byte_mask in let c = Char.code (Bytes.get s j_byte) in ((c lsr j_bit) land 1) = 1 (* * Add an edge. *) let add m i j = let s = m.(i) in let j_byte = j lsr byte_shift in let j_bit = j land byte_mask in let c = Char.code (Bytes.get s j_byte) in let c = c lor (1 lsl j_bit) in Bytes.set s j_byte (Char.chr c) (* * Remove an edge. *) let remove m i j = let s = m.(i) in let j_byte = j lsr byte_shift in let j_bit = j land byte_mask in let c = Char.code (Bytes.get s j_byte) in let c = c land (lnot (1 lsl j_bit)) in Bytes.set s j_byte (Char.chr c) (*! * @docoff * * -*- * Local Variables: * Caml-master: "compile" * End: * -*- *)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>