package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file gsize.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
(**************************************************************************)
(*                ocgtk - OCaml bindings for GTK4                         *)
(*                                                                        *)
(*    This program is free software; you can redistribute it              *)
(*    and/or modify it under the terms of the GNU Library General         *)
(*    Public License version 2, as published by the                       *)
(*    Free Software Foundation with the exception described in file       *)
(*    COPYING which comes with the library.                               *)
(*                                                                        *)
(*    Based on lablgtk3 (https://github.com/garrigue/lablgtk)             *)
(*                                                                        *)
(**************************************************************************)

type t = private int

external unsafe_of_int : int -> t = "%identity"

let of_int n =
  if n < 0 then
    invalid_arg (Printf.sprintf "Gsize.of_int: value %d is negative" n)
  else unsafe_of_int n

let to_int (t : t) = (t :> int)
let zero = unsafe_of_int 0
let max_int = unsafe_of_int Stdlib.max_int
let min_value = 0
let max_value = Stdlib.max_int