package decompress

  1. Overview
  2. Docs

Source file decompress_b.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
module Bigstring = Decompress_bigstring
module Bytes = Decompress_bytes

type 'a t =
  | Bytes : Bytes.t t
  | Bigstring : Bigstring.t t

let bytes = Bytes
let bigstring = Bigstring

let create
  : type a. a t -> int -> a
  = function
    | Bytes -> Bytes.create
    | Bigstring -> Bigstring.create

let length
  : type a. a t -> a -> int
  = function
  | Bytes -> Bytes.length
  | Bigstring -> Bigstring.length

let get
  : type a. a t -> a -> int -> char
  = function
  | Bytes -> Bytes.get
  | Bigstring -> Bigstring.get

let set
  : type a. a t -> a -> int -> char -> unit
  = function
  | Bytes -> Bytes.set
  | Bigstring -> Bigstring.set

let get_16
  : type a. a t -> a -> int -> int
  = function
  | Bytes -> Bytes.get_16
  | Bigstring -> Bigstring.get_16

let get_32
  : type a. a t -> a -> int -> int32
  = function
  | Bytes -> Bytes.get_32
  | Bigstring -> Bigstring.get_32

let get_64
  : type a. a t -> a -> int -> int64
  = function
  | Bytes -> Bytes.get_64
  | Bigstring -> Bigstring.get_64

let set_16
  : type a. a t -> a -> int -> int -> unit
  = function
  | Bytes -> Bytes.set_16
  | Bigstring -> Bigstring.set_16

let set_u32
  : type a. a t -> a -> int -> int32 -> unit
  = function
  | Bytes -> Bytes.set_32
  | Bigstring -> Bigstring.set_32

let set_64
  : type a. a t -> a -> int -> int64 -> unit
  = function
  | Bytes -> Bytes.set_64
  | Bigstring -> Bigstring.set_64

let sub
  : type a. a t -> a -> int -> int -> a
  = function
  | Bytes -> Bytes.sub
  | Bigstring -> Bigstring.sub

let fill
  : type a. a t -> a -> int -> int -> char -> unit
  = function
  | Bytes -> Bytes.fill
  | Bigstring -> fun v off len chr -> Bigstring.fill (Bigstring.sub v off len) chr

let blit
  : type a. a t -> a -> int -> a -> int -> int -> unit
  = function
  | Bytes -> Bytes.blit
  | Bigstring -> Bigstring.blit

let blit2
  : type a. a t -> a -> int -> a -> int -> a -> int -> int -> unit
  = function
  | Bytes -> Bytes.blit2
  | Bigstring -> Bigstring.blit2

let pp
  : type a. a t -> Format.formatter -> a -> unit
  = function
  | Bytes -> Bytes.pp
  | Bigstring -> Bigstring.pp

let to_string
  : type a. a t -> a -> string
  = function
  | Bytes -> Bytes.to_string
  | Bigstring -> Bigstring.to_string

let empty
  : type a. a t -> a
  = function
  | Bytes -> Bytes.empty
  | Bigstring -> Bigstring.empty
OCaml

Innovation. Community. Security.