Mojo function
byte_permute
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?
Thank you! We'll create more content like this.
Thank you for helping us improve!