package xapi-stdext-zerocheck

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val is_all_zeros : string -> int -> bool

is_all_zeroes x len returns true if the substring is all zeroes

val find_a_zero : string -> int -> int -> int option

find_a_zero x len offset returns the offset in x of a zero character after offset, or None if no zero was detected. Note this function is approximate and is not guaranteed to find strictly the first zero.

val find_a_nonzero : string -> int -> int -> int option

find_a_nonzero x len offset returns the offset in x of a nonzero character after offset, or None if none could be detected. Note this function is approximate and is not guaranteed to find strictly the first nonzero.

type substring = {
  1. buf : string;
  2. offset : int;
  3. len : int;
}
val fold_over_nonzeros : string -> int -> (int -> int) -> (int -> int) -> ('a -> substring -> 'a) -> 'a -> 'a

fold_over_nonzeros buf len rounddown roundup f initial folds f over all (start, length) pairs of non-zero data in string buf up to len. The start of each pair is rounded down with rounddown and the end offset of each pair is rounded up with roundup (e.g. to potential block boudaries.