IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo struct

BitLayout

struct BitLayout

A linear map over F2: domain bit i goes to img[i].

dom marks the domain bits the map has. A bit outside it does not address the codomain at all. dead marks domain bits whose points hold nothing, such as lanes an instruction leaves idle; their images are zero.

Fields​

  • ​img (SIMD[.uint64, 64]): The image of each domain bit; zero outside dom and on dead.
  • ​dom (UInt64): The domain bits the map has.
  • ​dead (UInt64): The domain bits whose points hold nothing.

Implemented traits​

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable, Writable

Methods​

__init__​

def __init__() -> Self

Creates the empty map.

__eq__​

def __eq__(self, other: Self) -> Bool

Returns whether two maps have the same domain, dead bits and images.

Args:

  • ​other (Self): The map to compare with.

Returns:

Bool: True when the maps are equal.

put​

def put(self, d: Int, image: UInt64) -> Self

Returns this map with domain bit d going to image.

Args:

  • ​d (Int): The domain bit.
  • ​image (UInt64): Its image.

Returns:

Self: The extended map.

kill​

def kill(self, d: Int) -> Self

Returns this map with domain bit d holding nothing.

Args:

  • ​d (Int): The domain bit.

Returns:

Self: The extended map.

run​

def run(self, d0: Int, n: Int, c0: Int) -> Self

Returns this map with domain bits d0 .. d0 + n - 1 going to codomain bits c0 .. c0 + n - 1: the strided mode (2^n : 2^c0).

Args:

  • ​d0 (Int): The lowest domain bit.
  • ​n (Int): The number of bits.
  • ​c0 (Int): The codomain bit d0 goes to.

Returns:

Self: The extended map.

has​

def has(self, d: Int) -> Bool

Returns whether domain bit d is in the map.

Args:

  • ​d (Int): The domain bit.

Returns:

Bool: True when d is in dom.

is_dead​

def is_dead(self, d: Int) -> Bool

Returns whether domain bit d holds nothing.

Args:

  • ​d (Int): The domain bit.

Returns:

Bool: True when d is in dead.

live​

def live(self) -> UInt64

Returns the domain bits that address the codomain.

Returns:

UInt64: dom without dead.

__call__​

def __call__(self, x: UInt64) -> UInt64

Maps a point.

Args:

  • ​x (UInt64): A point of the domain; bits outside dom are ignored.

Returns:

UInt64: The XOR of the images of x's set domain bits.

write_to​

def write_to(self, mut writer: T)

Writes the map as {bit: image, ...}, with x for a dead bit.

Args:

  • ​writer (T): The writer to write to.

Was this page helpful?