{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method SetBits | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetBits

    SetBits(int, bool, int)

    Sets a range of bits to 0 or 1.

    Declaration
    public void SetBits(int pos, bool value, int numBits)
    Parameters
    Type Name Description
    int pos

    Index of the first bit to set.

    bool value

    True for 1, false for 0.

    int numBits

    Number of bits to set.

    Remarks

    The range runs from index pos up to (but not including) pos + numBits. No exception is thrown if pos + numBits exceeds the length.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if pos is out of bounds or if numBits is less than 1.

    SetBits(int, ulong, int)

    Copies bits of a ulong to bits in this array.

    Declaration
    public void SetBits(int pos, ulong value, int numBits = 1)
    Parameters
    Type Name Description
    int pos

    Index of the first bit to set.

    ulong value

    Unsigned long from which to copy bits.

    int numBits

    Number of bits to set (must be between 1 and 64).

    Remarks

    The destination bits in this array run from index pos up to (but not including) pos + numBits. No exception is thrown if pos + numBits exceeds the length.

    The lowest bit of the ulong is copied to the first destination bit; the second-lowest bit of the ulong is copied to the second destination bit; and so forth.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if pos is out of bounds or if numBits is not between 1 and 64.

    In This Article
    Back to top
    Copyright © 2023 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)