Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BitField32

A 32-bit array of bits.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Struct
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule
public struct BitField32

Remarks

Stack allocated, so it does not require thread safety checks or disposal.

Fields

Value

Description

ValueThe 32 bits, stored as a uint.

Constructors

Constructor

Description

BitField32(System.UInt32)Initializes and returns an instance of BitField32.

Methods

Method

Description

ClearClears all the bits to 0.
CountBitsReturns the number of bits that are 1.
CountLeadingZerosReturns the number of leading zeroes.
CountTrailingZerosReturns the number of trailing zeros.
GetBitsReturns one or more contiguous bits from the bit field as the lower bits of a uint.
IsSetReturns true if the bit at a position is 1.
SetBitsSets a single bit to 1 or 0.
TestAllReturns true if all of the bits in a contiguous range are 1.
TestAnyReturns true if any of the bits in a contiguous range are 1.
TestNoneReturns true if none of the bits in a contiguous range are 1.