docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Left Shift (Bitwise)

    Menu Path : Operator > Bitwise > Left Shift

    The Left Shift Operator shifts the first input's value left by the number of bits defined in the second input. During the shift, this Operator discards the most-significant bit and inserts a 0 on the right.

    For example, if the first input is 21, which is 10101 in binary representation, and the number of bits to left shift it by is 3, the result is 168, which is 10101000 in binary representation. Shifting left produces the same result as multiplying the input value by 2n, so the shift result is the same as:

    21 * 23 21 * 8 168

    Operator properties

    Input Type Description
    A uint The value to shift left.
    B uint The number of bits to shift A by.
    Output Type Description
    o uint The result of the left shift by B number of bits.
    In This Article
    • Operator properties
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)