summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-sys/immediate64.ml
blob: 0f7dea7c42beacd6be9e9a27b09307b2515c4f6d (plain)
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
(* TEST
*)

module M : sig
  type t [@@immediate64]
  val zero : t
  val one : t
  val add : t -> t -> t
end = struct

  include Sys.Immediate64.Make(Int)(Int64)

  module type S = sig
    val zero : t
    val one : t
    val add : t -> t -> t
  end

  let impl : (module S) =
    match repr with
    | Immediate ->
        (module Int : S)
    | Non_immediate ->
        (module Int64 : S)

  include (val impl : S)
end

let () =
  match Sys.word_size with
  | 64 -> assert (Obj.is_int (Obj.repr M.zero))
  | _  -> assert (Obj.is_block (Obj.repr M.zero))