Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BitHelper.cs
Go to the documentation of this file.
1
namespace
System.Collections.Generic
;
2
3
internal
ref struct
BitHelper
4
{
5
private
readonly
Span<int>
_span
;
6
7
internal
BitHelper
(
Span<int>
span
,
bool
clear
)
8
{
9
if
(
clear
)
10
{
11
span
.
Clear
();
12
}
13
_span
=
span
;
14
}
15
16
internal
void
MarkBit
(
int
bitPosition
)
17
{
18
int
num =
bitPosition
/ 32;
19
if
((uint)num < (uint)
_span
.
Length
)
20
{
21
_span
[num] |= 1 <<
bitPosition
% 32;
22
}
23
}
24
25
internal
bool
IsMarked
(
int
bitPosition
)
26
{
27
int
num =
bitPosition
/ 32;
28
if
((uint)num < (uint)
_span
.
Length
)
29
{
30
return
(
_span
[num] & (1 <<
bitPosition
% 32)) != 0;
31
}
32
return
false
;
33
}
34
35
internal
static
int
ToIntArrayLength
(
int
n
)
36
{
37
if
(
n
<= 0)
38
{
39
return
0;
40
}
41
return
(
n
- 1) / 32 + 1;
42
}
43
}
System.Collections.Generic.Dictionary.Clear
void Clear()
Definition
Dictionary.cs:904
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Collections.Generic.BitHelper.MarkBit
void MarkBit(int bitPosition)
Definition
BitHelper.cs:16
System.Collections.Generic.BitHelper.BitHelper
BitHelper(Span< int > span, bool clear)
Definition
BitHelper.cs:7
System.Collections.Generic.BitHelper.ToIntArrayLength
static int ToIntArrayLength(int n)
Definition
BitHelper.cs:35
System.Collections.Generic.BitHelper._span
readonly Span< int > _span
Definition
BitHelper.cs:5
System.Collections.Generic.BitHelper.IsMarked
bool IsMarked(int bitPosition)
Definition
BitHelper.cs:25
System.Collections.Generic.BitHelper
Definition
BitHelper.cs:4
System.Span.Length
int Length
Definition
Span.cs:70
source
System.Collections
System.Collections.Generic
BitHelper.cs
Generated by
1.10.0