package ooh

  1. Overview
  2. Docs

Source file encoded.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
(* SPDX-FileCopyrightText: Copyright (C) 2025 Stefan Muenzel
 * SPDX-License-Identifier: MPL-2.0
 *)

type 'v t = int [@@immediate]

module Int61_high_bits = struct
  type value = int
  
  let unchecked_encode (x : value) : value t = x

  let encode_exn (x : value) : value t =
    if x land 0b11 <> 0 then raise (Invalid_argument "x land 0b11 <> 0") else x

  let decode (x : value t) : value = x
end

module Raw = struct
  let to_int (x : _ t) : int = x
end

module Private = struct
  let unsafe_create (x : _ t) : _ t = x
end
OCaml

Innovation. Community. Security.