


## bit-vector.api
# Compiled by:
# src/lib/std/standard.libapi Bit_Vector = api {
include Typelocked_Vector; # Typelocked_Vector is from src/lib/std/src/typelocked-vector.api/**
where type Element = Bool
**/
from_string: String -> Vector;
# The string argument gives a hexadecimal
# representation of the bits set in the
# vector. Characters 0-9, a-f and A-F are
# allowed. For example,
# from_string "1af8" = 0001101011111000
# (by convention, 0 corresponds to FALSE and 1 corresponds
# to TRUE, bit 0 appears on the right,
# and indices increase to the left)
# The length of the vector will be 4*(size string).
# Raises LibBase::BadArg if a non-hexadecimal character
# appears in the string.
bits: ((Int, List( Int )) ) -> Vector;
# Create vector of the given length with the indices of its set bits
# given by the list argument.
# Raises SUBSCRIPT if a list item is < 0 or >= length.
get_bits: Vector -> List( Int );
# Returns list of bits set in bit rw_vector, in increasing
# order of indices.
to_string: Vector -> String;
# Inverse of stringToBits.
# The bit rw_vector is zero-padded to the next
# length that is a multiple of 4.
is_zero: Vector -> Bool;
# Returns TRUE if and only if no bits are set.
extend0: ((Vector, Int)) -> Vector;
extend1: ((Vector, Int)) -> Vector;
# Extend bit rw_vector by 0's or 1's to given length.
# If bit rw_vector is already >= argument length, return a copy
# of the bit rw_vector.
# Raises SIZE if length < 0.
eq_bits: ((Vector, Vector)) -> Bool;
# TRUE if set bits are identical
equal: ((Vector, Vector)) -> Bool;
# TRUE if same length and same set bits
bitwise_and: ((Vector, Vector, Int)) -> Vector;
bitwise_or: ((Vector, Vector, Int)) -> Vector;
bitwise_xor: ((Vector, Vector, Int)) -> Vector;
# Create new vector of the given length
# by logically combining bits of original
# vectors using and, or and xor, respectively.
# If necessary, the vectors are
# implicitly extended by 0 to be the same length
# as the new vector.
bitwise_not: Vector -> Vector;
# Create new vector with all bits of original
# vector inverted.
lshift: ((Vector, Int)) -> Vector;
# lshift (ba, n) creates a new vector by
# inserting n 0's on the right of ba.
# The new vector has length n + length ba.
rshift: ((Vector, Int)) -> Vector;
# rshift (ba, n) creates a new vector of
# of length max (0, length ba - n) consisting
# of bits n, n+1, ..., length ba - 1 of ba.
# If n >= length ba, the new vector has length 0.
}
where Element == Bool;
## COPYRIGHT (c) 1995 by AT&T Bell Laboratories. See COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2011,
## released under Gnu Public Licence version 3.


