@shlExact

@shlExact

@shlExact(value: T, shift_amt: Log2T) T

Performs the left shift operation (<<). For unsigned integers, the result is undefined if any 1 bits are shifted out. For signed integers, the result is undefined if any bits that disagree with the resultant sign bit are shifted out.

The type of shift_amt is an unsigned integer with log2(@typeInfo(T).Int.bits) bits. This is because shift_amt >= @typeInfo(T).Int.bits is undefined behavior.

comptime_int is modeled as an integer with an infinite number of bits, meaning that in such case, @shlExact always produces a result and cannot produce a compile error.

See also:

  • @shrExact
  • @shlWithOverflow