Up
# module Core_int

: sig
###### Conversion functions

OCaml's native integer type.

The number of bits in an integer is platform dependent, being 31-bits on a 32-bit
platform, and 63-bits on a 64-bit platform. `int`

is a signed integer type. `int`

s
are also subject to overflow, meaning that `Int.max_value + 1 = Int.min_value`

.

`int`

s always fit in a machine word.

include Int_intf.S with type t = int

#

val ceil_pow2 : int -> int

`ceil_pow2 x`

returns the smallest power of 2 that is greater than or equal to `x`

.
The implementation may only be called for `x > 0`

. Example: `ceil_pow2 17 = 32`

#

val floor_pow2 : int -> int

`floor_pow2 x`

returns the largest power of 2 that is less than or equal to `x`

. The
implementation may only be called for `x > 0`

. Example: `floor_pow2 17 = 16`

#

val is_pow2 : int -> bool

`is_pow2 x`

returns true iff `x`

is a power of 2. `is_pow2`

raises if `x <= 0`

.

end