package qcow-types

  1. Overview
  2. Docs
Minimal set of dependencies for qcow-stream, shared with qcow

Install

dune-project
 Dependency

Authors

Maintainers

Sources

qcow-0.12.3.tbz
sha256=ebeaaab614d7c5350f3f5217525d4f34bf0859f7bdec22f1ea834b47fc6358dd
sha512=eb0c24333ca065c8511427cde7a23db886b83d9e3ff233702c006a713ad8c418a29a2a3746481d26053fea03f0a07ac93a57b966e547bf5dddf7b4e10ae731bd

doc/src/qcow-types/qcow_int.ml.html

Source file qcow_int.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
(*
 * Copyright (C) 2015 David Scott <dave@recoil.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 *)
open Sexplib.Std

module M = struct
  type t = int [@@deriving sexp]

  let zero = 0

  let succ x = x + 1

  let pred x = x - 1

  let add x y = x + y

  let sub x y = x - y

  let compare (x : t) (y : t) = Stdlib.compare x y

  let mul x y = x * y

  let div x y = x / y

  let to_int64 = Int64.of_int

  let of_int64 = Int64.to_int

  let to_int x = x

  let of_int x = x

  let to_string = string_of_int

  let shift_left x n = x lsl n

  let shift_right_logical x n = x lsr n

  let logor x y = x lor y

  let rem x y = x mod y
end

module IntervalSet = Diet.Make(M)
module Map = Map.Make (M)
include M

let round_up x size = mul (div (add x (pred size)) size) size