package frenetic

  1. Overview
  2. Docs
The Frenetic Programming Language and Runtime System

Install

Dune Dependency

Authors

Maintainers

Sources

5.0.5.tar.gz
md5=baf754df13a759c32f2c86a1b6f328da
sha512=80140900e7009ccab14b25e244fe7edab87d858676f8a4b3799b4fea16825013cf68363fe5faec71dd54ba825bb4ea2f812c2c666390948ab217ffa75d9cbd29

doc/frenetic.kernel/Frenetic_kernel/Bits/index.html

Module Frenetic_kernel.BitsSource

Bit manipulation for integers

Though Std has bitwise and's, or's and shifting, Frenetic needs some more bit-specific primitives. Other libraries like bitv have them, but they require converting back and forth to abstract data types ... this approach is faster and less complex.

Sourceval clear_bit : int -> int32 -> int32

clear_bit n x sets bit n in integer x to 0

Sourceval set_bit : int -> int32 -> int32

set_bit n x sets bit n in integer x to 1

Sourceval bit : int32 -> int -> bool -> int32

bit x n set_bit sets bit n of integer x to 1 if set_bit=true, 0 otherwise.

Sourceval test_bit : int -> int32 -> bool

test_bit n x returns true if bit n in integer x is 1

Sourceval get_byte32 : int32 -> int -> int

get_byte32 x n returns the n'th byte of int32 x. The least significant byte is 0, the most is 3. Raises error if n is not in 0..3

Sourceval get_byte : int64 -> int -> int

get_byte x n returns the n'th byte of int64 x. The least significant byte is 0, the most is 7. Raises error if n is not in 0..7

OCaml

Innovation. Community. Security.