package ocaml_intrinsics

  1. Overview
  2. Docs
include module type of struct include Ocaml_intrinsics_kernel.Conditional end
val select_value : bool -> 'a -> 'a -> 'a

select_value c a b is equivalent to if c then a else b) where a and b are eagerly evaluated, regardless of the value of c. Compiles to CMOV instruction on amd64 targets. Can be used to avoid branch misprediction when c is data dependent.

val select_int : bool -> int -> int -> int
val select_int64 : bool -> int64 -> int64 -> int64
val select_int32 : bool -> int32 -> int32 -> int32
val select_nativeint : bool -> nativeint -> nativeint -> nativeint
OCaml

Innovation. Community. Security.