Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

UnsafeBitArray.SetBits

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetBits(int pos, bool value, int numBits);

Parameters

Parameter Description
pos Index of the first bit to set.
value True for 1, false for 0.
numBits Number of bits to set.

Description

Sets a range of bits to 0 or 1.

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


Declaration

public void SetBits(int pos, ulong value, int numBits);

Parameters

Parameter Description
pos Index of the first bit to set.
value Unsigned long from which to copy bits.
numBits Number of bits to set (must be between 1 and 64).

Description

Copies bits of a ulong to bits in this array.

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.