# BitField32

> A 32-bit array of bits.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public struct BitField32
```

## Remarks

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

## Fields

| Value                                                                          | Description                    |
| ------------------------------------------------------------------------------ | ------------------------------ |
| [Value](/engine/6000.7/script-reference/unity/collections/bitfield32/value.md) | The 32 bits, stored as a uint. |

## Constructors

| Constructor                                                                                       | Description                                        |
| ------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [BitField32(System.UInt32)](/engine/6000.7/script-reference/unity/collections/bitfield32/ctor.md) | Initializes and returns an instance of BitField32. |

## Methods

| Method                                                                                                   | Description                                                                         |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [Clear](/engine/6000.7/script-reference/unity/collections/bitfield32/clear.md)                           | Clears all the bits to 0.                                                           |
| [CountBits](/engine/6000.7/script-reference/unity/collections/bitfield32/countbits.md)                   | Returns the number of bits that are 1.                                              |
| [CountLeadingZeros](/engine/6000.7/script-reference/unity/collections/bitfield32/countleadingzeros.md)   | Returns the number of leading zeroes.                                               |
| [CountTrailingZeros](/engine/6000.7/script-reference/unity/collections/bitfield32/counttrailingzeros.md) | Returns the number of trailing zeros.                                               |
| [GetBits](/engine/6000.7/script-reference/unity/collections/bitfield32/getbits.md)                       | Returns one or more contiguous bits from the bit field as the lower bits of a uint. |
| [IsSet](/engine/6000.7/script-reference/unity/collections/bitfield32/isset.md)                           | Returns true if the bit at a position is 1.                                         |
| [SetBits](/engine/6000.7/script-reference/unity/collections/bitfield32/setbits.md)                       | Sets a single bit to 1 or 0.                                                        |
| [TestAll](/engine/6000.7/script-reference/unity/collections/bitfield32/testall.md)                       | Returns true if all of the bits in a contiguous range are 1.                        |
| [TestAny](/engine/6000.7/script-reference/unity/collections/bitfield32/testany.md)                       | Returns true if any of the bits in a contiguous range are 1.                        |
| [TestNone](/engine/6000.7/script-reference/unity/collections/bitfield32/testnone.md)                     | Returns true if none of the bits in a contiguous range are 1.                       |
