From af8a516fc22865abd80d6e26f1541fa3d6bebfdc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 9 May 2024 00:42:44 +0200 Subject: MHR-23: :boom:, refactors. - Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss --- Kernel/NewKit/Atom.hpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Kernel/NewKit/Atom.hpp (limited to 'Kernel/NewKit/Atom.hpp') diff --git a/Kernel/NewKit/Atom.hpp b/Kernel/NewKit/Atom.hpp new file mode 100644 index 00000000..df7d3dda --- /dev/null +++ b/Kernel/NewKit/Atom.hpp @@ -0,0 +1,46 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ +#pragma once + +#include + +namespace NewOS +{ + template + class Atom final + { + public: + explicit Atom() = default; + ~Atom() = default; + + public: + Atom& operator=(const Atom&) = delete; + Atom(const Atom&) = delete; + + public: + T operator[](Size sz) + { + return (fArrayOfAtoms & sz); + } + void operator|(Size sz) + { + fArrayOfAtoms |= sz; + } + + friend Boolean operator==(Atom& atomic, const T& idx) + { + return atomic[idx] == idx; + } + + friend Boolean operator!=(Atom& atomic, const T& idx) + { + return atomic[idx] == idx; + } + + private: + T fArrayOfAtoms; + }; +} // namespace NewOS -- cgit v1.2.3