Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

common.wgsl

Structures

Uint64

#

We cannot rely on native 64-bit integers, so we define our own 64-bit integer type as two 32-bit integers.

struct Uint64 {
low: u32 ,
high: u32 ,
}

Uint96

#

96-bit unsigned integer type.

struct Uint96 {
low: u32 ,
mid: u32 ,
high: u32 ,
}

Functions

truncate_u96_to_u64

#

Truncates a 96-bit number to a 64-bit number by discarding the upper 32 bits.

fn truncate_u96_to_u64 ( ) -> Uint64

low

#

Returns the lower 16 bits of a 32-bit integer.

fn low ( ) -> u32

high

#

Returns the upper 16 bits of a 32-bit integer.

fn high ( ) -> u32

u32_from_u16s

#

The high 16 bits of each argument are discarded.

fn u32_from_u16s ( ) -> u32

u64_mul_u32

#

The number of digits (bits) needed to represent the result of a multiplication is the sum of the number of input digits (bits). Since we are multiplying a 64-bit number by a 32-bit number, we need 96 bits to represent the result.

fn u64_mul_u32 ( ) -> Uint96

shift_right_96

#

The shift is in the range [0, 32].

fn shift_right_96 (
shift: u32
) -> Uint96