Skip to main content

Module field_buffer

Module field_buffer 

Source
Expand description

A power-of-two-sized buffer of packed field elements.

The buffer lives in this file, with its methods and the guard its halving methods hand out. SplitMut is built in exactly one place, so it needs no visibility beyond this module.

The rest sits in modules of their own:

chunks      the buffer's chunk methods, and the iterators and guard they hand out
structured  a buffer that may hold one aligned block explicitly, and zero elsewhere
view        the borrowed aliases, which name the buffer rather than being produced by it

§Why the backing store is a type parameter

A store’s length fixes the element count only once the buffer fills a whole packed word. Below one word, the same single word backs any length:

WIDTH = 4 lanes per word

1 element   ->  [ x . . . ]   one word
2 elements  ->  [ x x . . ]   one word
4 elements  ->  [ x x x x ]   one word

So the logical length is irreducible extra state, carried alongside the store. That rules out a transparent wrapper around a packed slice. With it goes the deref-coercion design a vector and its two slice types enjoy.

Structs§

ChunkMut
Guards one mutably borrowed chunk of a buffer.
Chunks
Iterator over a buffer’s chunks of a fixed size, each borrowed as a shared view.
ChunksMut
Iterator over a buffer’s chunks of a fixed size, each borrowed as a mutable view.
FieldBuffer
A power-of-two-sized buffer containing field elements, stored in packed fields.
SplitMut
Guards the two halves of a buffer that was split along its highest variable.

Enums§

FieldSliceData
StructuredBuffer
A field buffer that may hold explicit values for only one aligned block, and zero elsewhere.

Type Aliases§

FieldSlice
Alias for a field buffer over a borrowed slice.
FieldSliceMut
Alias for a field buffer over a mutably borrowed slice.
FieldVec
A field buffer whose backing store is drawn from an allocator.