Module Mixed_product_bytes.Wrt_path
A path into a mixed block element (identifying some subelement) can be considered to partition the mixed block element into three parts: to the left, at subelement, and to the right.
This module counts the number of value and flat bytes in each part, for the purpose of computing block indices to the subelement. Also see jane/doc/extensions/_03-unboxed-types/03-block-indices.md.
type mpb := Mixed_product_bytes.ttype t = {here : Mixed_product_bytes.Wrt_path.mpb;left : Mixed_product_bytes.Wrt_path.mpb;right : Mixed_product_bytes.Wrt_path.mpb;
}val zero : Mixed_product_bytes.Wrt_path.tval count :
unit Lambda.mixed_block_element ->
int list ->
Mixed_product_bytes.Wrt_path.tGiven an outer mixed block element, and a path into that as a list of positions, count value/flat bytes to the left, at, and to the right that subelement
val count_shape :
Lambda.mixed_block_shape ->
int ->
int list ->
Mixed_product_bytes.Wrt_path.tSimilar to the above, except for a mixed_block_shape (which corresponds to a boxed record, while a unit mixed_block_element corresponds to an unboxed record (within an array or boxed record).
type offset_and_gap_bytes = {offset_bytes : Mixed_product_bytes.Byte_count.t;gap_bytes : Mixed_product_bytes.Byte_count.t;
}val offset_and_gap :
Mixed_product_bytes.Wrt_path.t ->
Mixed_product_bytes.Wrt_path.offset_and_gap_bytes optionCompute the offset and gap in bytes for an index to here. Returns None if the index could lead to an "illegal" gap of 2^16 or greater bytes, which is the case if either:
- An index to
herewould have an illegal gap. - Conservatively, whether an index to
herecould be deepened to have an illegal gap.