Struct BitField32 | Collections | 0.4.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Struct BitField32

    Fixed size 32-bit array of bits.

    Namespace: Unity.Collections
    Syntax
    public struct BitField32

    Constructors

    BitField32(UInt32)

    Constructor.

    Declaration
    public BitField32(uint initialValue = 0U)
    Parameters
    Type Name Description
    UInt32 initialValue

    Initial value of bit field. Default is 0.

    Fields

    Value

    Declaration
    public uint Value
    Field Value
    Type Description
    UInt32

    Methods

    Clear()

    Clear all bits to 0.

    Declaration
    public void Clear()

    CountBits()

    Calculate number of set bits.

    Declaration
    public int CountBits()
    Returns
    Type Description
    Int32

    Number of set bits.

    CountLeadingZeros()

    Calculate number of leading zeros.

    Declaration
    public int CountLeadingZeros()
    Returns
    Type Description
    Int32

    Number of leading zeros

    CountTrailingZeros()

    Calculate number of trailing zeros.

    Declaration
    public int CountTrailingZeros()
    Returns
    Type Description
    Int32

    Number of trailing zeros

    GetBits(Int32, Int32)

    Returns all bits in range as uint.

    Declaration
    public uint GetBits(int pos, int numBits = 1)
    Parameters
    Type Name Description
    Int32 pos

    Position in bitfield (must be 0-31).

    Int32 numBits

    Number of bits to get (must be 1-32).

    Returns
    Type Description
    UInt32

    Returns requested range of bits.

    IsSet(Int32)

    Returns true is bit at position is set.

    Declaration
    public bool IsSet(int pos)
    Parameters
    Type Name Description
    Int32 pos

    Position in bitfield (must be 0-31).

    Returns
    Type Description
    Boolean

    Returns true if bit is set.

    SetBits(Int32, Boolean)

    Set single bit to desired boolean value.

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

    Position in bitfield (must be 0-31).

    Boolean value

    Value of bits to set.

    SetBits(Int32, Boolean, Int32)

    Set bits to desired boolean value.

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

    Position in bitfield (must be 0-31).

    Boolean value

    Value of bits to set.

    Int32 numBits

    Number of bits to set (must be 1-32).

    TestAll(Int32, Int32)

    Returns true if all of bits in range are set.

    Declaration
    public bool TestAll(int pos, int numBits = 1)
    Parameters
    Type Name Description
    Int32 pos

    Position in bitfield (must be 0-31).

    Int32 numBits

    Number of bits to test (must be 1-32).

    Returns
    Type Description
    Boolean

    Returns true if all bits are set.

    TestAny(Int32, Int32)

    Returns true if any of bits in range are set.

    Declaration
    public bool TestAny(int pos, int numBits = 1)
    Parameters
    Type Name Description
    Int32 pos

    Position in bitfield (must be 0-31).

    Int32 numBits

    Number of bits to test (must be 1-32).

    Returns
    Type Description
    Boolean

    Returns true if at least one bit is set.

    TestNone(Int32, Int32)

    Returns true if none of bits in range are set.

    Declaration
    public bool TestNone(int pos, int numBits = 1)
    Parameters
    Type Name Description
    Int32 pos

    Position in bitfield (must be 0-31).

    Int32 numBits

    Number of bits to test (must be 1-32).

    Returns
    Type Description
    Boolean

    Returns true if none of bits are set.

    Extension Methods

    JobNativeMultiHashMapVisitKeyValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobNativeMultiHashMapVisitKeyMutableValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobUnsafeMultiHashMapVisitKeyValue.Schedule<TJob, TKey, TValue>(TJob, UnsafeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobUnsafeMultiHashMapVisitKeyMutableValue.Schedule<TJob, TKey, TValue>(TJob, UnsafeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    In This Article
    • Constructors
      • BitField32(UInt32)
    • Fields
      • Value
    • Methods
      • Clear()
      • CountBits()
      • CountLeadingZeros()
      • CountTrailingZeros()
      • GetBits(Int32, Int32)
      • IsSet(Int32)
      • SetBits(Int32, Boolean)
      • SetBits(Int32, Boolean, Int32)
      • TestAll(Int32, Int32)
      • TestAny(Int32, Int32)
      • TestNone(Int32, Int32)
    • Extension Methods
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023