# Index of values

A
add_bit [Bitstring.Buffer] |
add_bits [Bitstring.Buffer] |
add_byte [Bitstring.Buffer] |
B
bitstring_length [Bitstring] | `bitstring_length bitstring` returns the length of the bitstring in bits.
bitstring_of_chan [Bitstring] | `bitstring_of_chan chan` loads the contents of the input channel `chan` as a bitstring.
bitstring_of_chan_max [Bitstring] | `bitstring_of_chan_max chan max` works like `Bitstring.bitstring_of_chan` but will only read up to `max` bytes from the channel (or fewer if the end of input occurs before that).
bitstring_of_file [Bitstring] | `bitstring_of_file filename` loads the named file into a bitstring.
bitstring_of_file_descr [Bitstring] | `bitstring_of_file_descr fd` loads the contents of the file descriptor `fd` as a bitstring.
bitstring_of_file_descr_max [Bitstring] | `bitstring_of_file_descr_max fd max` works like `Bitstring.bitstring_of_file_descr` but will only read up to `max` bytes from the channel (or fewer if the end of input occurs before that).
bitstring_of_string [Bitstring] | `bitstring_of_string str` creates a bitstring of length `String.length str * 8` (bits) containing the bits in `str`.
bitstring_to_chan [Bitstring] | `bitstring_to_file bits filename` writes the bitstring `bits` to the channel `chan`.
bitstring_to_file [Bitstring] | `bitstring_to_file bits filename` writes the bitstring `bits` to the file `filename`.
C
clear [Bitstring] | `clear bits n` sets the `n`th bit in the bitstring to 0.
compare [Bitstring] | `compare bs1 bs2` compares two bitstrings and returns zero if they are equal, a negative number if `bs1 < bs2`, or a positive number if `bs1 > bs2`.
concat [Bitstring] | Concatenate a list of bitstrings together into a single bitstring.
contents [Bitstring.Buffer] |
create [Bitstring.Buffer] |
create_bitstring [Bitstring] | `create_bitstring n` creates an `n` bit bitstring containing all zeroes.
create_constructor_field [Bitstring_persistent] | Create a constructor field.
create_pattern_field [Bitstring_persistent] | Create a pattern field.
D
debug [Bitstring] | Set this variable to true to enable extended debugging.
dropbits [Bitstring] | Drop the first n bits of the bitstring and return a new bitstring which is shorter by n bits.
E
empty_bitstring [Bitstring] | `empty_bitstring` is the empty, zero-length bitstring.
equals [Bitstring] | `equals` returns true if and only if the two bitstrings are semantically equal.
G
get [Bitstring] | `get bits n` returns the `n`th bit (returns non-zero or 0).
get_bind [Bitstring_persistent] | Get the bind expression of a field, or `None` if there is none.
get_check [Bitstring_persistent] | Get the check expression of a field, or `None` if there is none.
get_endian [Bitstring_persistent] | Get the endianness of a field.
get_expr [Bitstring_persistent] | Get the expression from an expression field.
get_length [Bitstring_persistent] | Get the length in bits from a field.
get_location [Bitstring_persistent] | Get the source code location of a field.
get_offset [Bitstring_persistent] | Get the offset expression of a field, or `None` if there is none.
get_patt [Bitstring_persistent] | Get the pattern from a pattern field.
get_save_offset_to [Bitstring_persistent] | Get the save_offset_to pattern of a field, or `None` if there is none.
get_signed [Bitstring_persistent] | Get the signedness of a field.
get_type [Bitstring_persistent] | Get the type of a field, `Int`, `String` or `Bitstring`.
H
hexdump_bitstring [Bitstring] | `hexdump_bitstring chan bitstring` prints the bitstring to the output channel in a format similar to the Unix command `hexdump -C`.
I
is_clear [Bitstring] | `is_clear bits n` is true if the `n`th bit is set to 0.
is_ones_bitstring [Bitstring] | Tests if the bitstring is all one bits (cf.
is_set [Bitstring] | `is_set bits n` is true if the `n`th bit is set to 1.
is_zeroes_bitstring [Bitstring] | Tests if the bitstring is all zero bits (cf.
M
make_bitstring [Bitstring] | `make_bitstring n c` creates an `n` bit bitstring containing the repeated 8 bit pattern in `c`.
N
named_from_channel [Bitstring_persistent] | Load a pattern/constructor from an output channel.
named_from_string [Bitstring_persistent] | Load a pattern/constructor from a string at offset within the string.
named_to_buffer [Bitstring_persistent] | Serialize a pattern/constructor to part of a string, return the length.
named_to_channel [Bitstring_persistent] | Save a pattern/constructor to an output channel.
named_to_string [Bitstring_persistent] | Serialize a pattern/constructor to a string.
O
ones_bitstring [Bitstring] | `ones_bitstring` creates an `n` bit bitstring of all 1's.
P
package [Bitstring] | The package name, always `"ocaml-bitstring"`
put [Bitstring] | `put bits n v` sets the `n`th bit in the bitstring to 1 if `v` is not zero, or to 0 if `v` is zero.
S
set [Bitstring] | `set bits n` sets the `n`th bit in the bitstring to 1.
set_bind [Bitstring_persistent] | Set the bind-expression for a field to the given expression.
set_check [Bitstring_persistent] | Set the check expression for a field to the given expression.
set_endian [Bitstring_persistent] | Sets the endianness of a field to the constant endianness.
set_endian_expr [Bitstring_persistent] | Sets the endianness of a field to an endianness expression.
set_expr [Bitstring_persistent] | Sets the expression field to an arbitrary OCaml expression.
set_int_expr [Bitstring_persistent] | Sets the expression to the value of the integer.
set_int_patt [Bitstring_persistent] | Sets the pattern field to the pattern which matches an integer.
set_length [Bitstring_persistent] | Sets the length in bits of a field to an OCaml expression.
set_length_int [Bitstring_persistent] | Sets the length in bits of a field to a constant integer.
set_lident_expr [Bitstring_persistent] | Sets the expression in a constructor field to an expression which uses the identifier.
set_lident_patt [Bitstring_persistent] | Sets the pattern to the pattern binding an identifier given in the string.
set_location [Bitstring_persistent] | Sets the source code location of a field.
set_no_bind [Bitstring_persistent] | Remove the bind-expression from a field.
set_no_check [Bitstring_persistent] | Remove the check expression from a field.
set_no_offset [Bitstring_persistent] | Remove the offset expression from a field.
set_no_save_offset_to [Bitstring_persistent] | Remove the save_offset_to from a field.
set_offset [Bitstring_persistent] | Set the offset expression for a field to the given expression.
set_offset_int [Bitstring_persistent] | Set the offset expression for a field to the given number.
set_patt [Bitstring_persistent] | Sets the pattern field to an arbitrary OCaml pattern match.
set_save_offset_to [Bitstring_persistent] | Set the save_offset_to pattern for a field to the given pattern.
set_save_offset_to_lident [Bitstring_persistent] | Set the save_offset_to pattern for a field to identifier.
set_signed [Bitstring_persistent] | Sets the signedness of a field to a constant signedness.
set_string_expr [Bitstring_persistent] | Sets the expression to the value of the string.
set_string_patt [Bitstring_persistent] | Sets the pattern field to the pattern which matches a string.
set_type_bitstring [Bitstring_persistent] | Sets the type of a field to `bitstring`.
set_type_int [Bitstring_persistent] | Sets the type of a field to `int`.
set_type_string [Bitstring_persistent] | Sets the type of a field to `string`.
set_unbound_patt [Bitstring_persistent] | Sets the pattern field to the unbound pattern (usually written `_`).
string_of_bitstring [Bitstring] | `string_of_bitstring bitstring` converts a bitstring to a string (eg.
string_of_constructor [Bitstring_persistent] |
string_of_constructor_field [Bitstring_persistent] | Convert patterns, constructors or individual fields into printable strings for debugging purposes.
string_of_endian [Bitstring] | Endianness.
string_of_pattern [Bitstring_persistent] |
string_of_pattern_field [Bitstring_persistent] |
subbitstring [Bitstring] | `subbitstring bits off len` returns a sub-bitstring of the bitstring, starting at offset `off` bits and with length `len` bits.
T
takebits [Bitstring] | Take the first n bits of the bitstring and return a new bitstring which is exactly n bits long.
V
version [Bitstring] | The package version as a string.
Z
zeroes_bitstring [Bitstring] | `zeroes_bitstring` creates an `n` bit bitstring of all 0's.