Table Of Contents

bitshift

Version:
    Last Modified: March 15, 2017

    Performs a bitwise shift on the input elements. For example, if a = 9 (1001), bitshift(a, 1) = 18 (10010) and bitshift(a, 1, 4) = 2 (0010).

    Syntax

    d = bitshift(a, b)
    d = bitshift(a, b, c)

    Inputs

    a

    Scalar or array of any dimension of unsigned integer or floating point numbers with integer values. All elements of a must be less than 2^53-1.

    b

    Determines the shift sizes. b is a scalar or an array of any dimension of integer or floating point numbers with integer values. If b is negative, MathScript shifts to the right. Shifting a by b bits is equivalent to multiplying a by 2^b and then rounding to the nearest integer. b is the same size as a unless a or b is a scalar.

    c

    Number of valid bits for each of the shifted values. c is an array of the same size as a or b with unsigned integer or floating point numbers with integer values. If the shifted values exceed c bits, MathScript ignores the overflow.

    Outputs

    d

    Elements of a shifted to the left by b bits. d is an array of the same size as the larger of a and b.

    A = [134, 45, 232]
    B = [1, 2, 3]
    D = bitshift(A, B)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics