package ocaml_intrinsics

  1. Overview
  2. Docs

Module Ocaml_intrinsics.ConditionalSource

Sourceval 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.

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

Innovation. Community. Security.