package mula

  1. Overview
  2. Docs
ML's library for Universal Levenshtein Automata

Install

Dune Dependency

Authors

Maintainers

Sources

mula-0.1.0.tbz
sha256=c781cc1225b311f082a63da6dc10f94a44cdf5568e26ff070a66b62fc1482fe7
sha512=acd41a69b47163909e92665a65c2cdb6029b3c201f0b4d3c596e55fb6d8053b8615401fc3e5c929c899bc30e243d73497f32fa15f476e02cf26f2573c039b771

doc/src/mula.internal/bitVec.ml.html

Source file bitVec.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
type t = Bits of int [@@unboxed]

let[@inline] compare (Bits x) (Bits y) =
  Int.compare x y

let get k (Bits n) =
  let two_to_k = Int.shift_left Int.one (k - 1) in
  if Int.equal (Int.logand two_to_k n) 0 then
    false
  else
    true

let get_lane ~lane:l ~k bv =
  get (k + 1 - l) bv

let get_right_of_lane ~lane:l ~k ~m bv =
    get_lane ~lane:(l + m) ~k bv

let get_left_of_lane ~lane:l ~k ~m bv =
    get_lane ~lane:(l - m) ~k bv

let rec pos_fold ~f ~init n =
  match n with
  | 0 -> init
  | n -> pos_fold ~f ~init:(f n init) (n - 1)

let snoc_one (Bits n) =
  let n' = Int.logor Int.one (Int.shift_left n 1) in
  Bits n'

let snoc_zero (Bits n) =
  Bits (Int.shift_left n 1)

let zero = (Bits Int.zero)
OCaml

Innovation. Community. Security.