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 function

byte_permute

def byte_permute(a: UInt32, b: UInt32, c: UInt32) -> UInt32

Permutes bytes from two 32-bit integers based on a control mask.

Selects and rearranges bytes from two source integers based on a control mask to create a new 32-bit value.

Note: Byte selection behavior depends on the GPU architecture:

  • On NVIDIA: Maps to PRMT instruction
  • On AMD: Maps to PERM instruction.

Args:

  • โ€‹a (UInt32): First source integer containing bytes to select from.
  • โ€‹b (UInt32): Second source integer containing bytes to select from.
  • โ€‹c (UInt32): Control mask that specifies which bytes to select and their positions. Each byte in the mask controls selection/placement of one output byte.

Returns:

UInt32: A new 32-bit integer containing the selected and rearranged bytes

Was this page helpful?