blob: f9645fd85e2edd728e0d6b6b3c221dc04ef5b2a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* -------------------------------------------
Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
#pragma once
#include <NewKit/Defines.h>
namespace Kernel
{
template <typename T>
class Atom final
{
public:
explicit Atom() = default;
~Atom() = default;
public:
Atom& operator=(const Atom&) = delete;
Atom(const Atom&) = delete;
public:
T operator[](Size bit)
{
return (fArrayOfAtoms & (1 << bit));
}
void operator|(Size bit)
{
fArrayOfAtoms |= (1 << bit);
}
friend Boolean operator==(Atom<T>& atomic, const T& idx)
{
return atomic[idx] == idx;
}
friend Boolean operator!=(Atom<T>& atomic, const T& idx)
{
return atomic[idx] == idx;
}
private:
T fArrayOfAtoms;
};
} // namespace Kernel
|