Skip to contents

Element-wise left bit shift.

Usage

prim_shift_left(x, shift)

Arguments

x

(arrayish)
The array whose bits are shifted. Can be any integer data type.

shift

(arrayish)
By how many bits to shift each element of x. Has the same data type and shape as x. An R value takes the other operand's data type, and its default data type when neither operand has one.

Value

(arrayish)
Has the inputs' shape and data type.

Implemented Rules

  • stablehlo

  • reverse

StableHLO

Lowers to hlo_shift_left(), specified under shift_left.

See also

Examples

# two R values: both take an R integer's default data type
prim_shift_left(8L, 2L)
#> AnvlArray
#>  32
#> [ CPUi32{} ] 

# the R value is built at the array's data type instead
prim_shift_left(8L, nv_scalar(2L, "i64"))
#> AnvlArray
#>  32
#> [ CPUi64{} ]