Skip to content

daft.functions.shift_left#

shift_left #

shift_left(expr: Expression, num_bits: Expression) -> Expression

Shifts the bits of an integer expression to the left (expr << num_bits).

Parameters:

Name Type Description Default
expr Expression

The expression to shift.

required
num_bits Expression

The number of bits to shift the expression to the left

required
Source code in daft/functions/bitwise.py
29
30
31
32
33
34
35
36
37
38
def shift_left(expr: Expression, num_bits: Expression) -> Expression:
    """Shifts the bits of an integer expression to the left (``expr << num_bits``).

    Args:
        expr: The expression to shift.
        num_bits: The number of bits to shift the expression to the left
    """
    expr = Expression._to_expression(expr)
    num_bits = Expression._to_expression(num_bits)
    return Expression._from_pyexpr(expr._expr << num_bits._expr)