1
0
mirror of https://github.com/EnderIce2/Fennix.git synced 2025-07-12 15:59:17 +00:00
Files
.github
.vscode
Architecture
Core
Execute
FileSystem
Library
Bitmap.cpp
Convert.c
CyclicRedundancyCheck32.c
cargs.c
cwalk.c
cxxabi.cpp
dumper.cpp
liballoc_1_1.c
liballoc_1_1.h
liballocimpl.cpp
md5.c
printf.c
SystemCalls
Tasking
include
.gitignore
DAPI.hpp
Doxyfile
Fennix Kernel.code-workspace
Fex.hpp
KConfig.cpp
KThread.cpp
Kernel.cpp
LICENSE
Makefile
README.md
kernel.h
syscalls.h
Fennix/Library/Bitmap.cpp
2022-10-10 23:29:39 +03:00

29 lines
704 B
C++

#include <bitmap.hpp>
bool Bitmap::operator[](uint64_t index) { return Get(index); }
bool Bitmap::Get(uint64_t index)
{
if (index > Size * 8)
return false;
uint64_t byteIndex = index / 8;
uint8_t bitIndex = index % 8;
uint8_t bitIndexer = 0b10000000 >> bitIndex;
if ((Buffer[byteIndex] & bitIndexer) > 0)
return true;
return false;
}
bool Bitmap::Set(uint64_t index, bool value)
{
if (index > Size * 8)
return false;
uint64_t byteIndex = index / 8;
uint8_t bitIndex = index % 8;
uint8_t bitIndexer = 0b10000000 >> bitIndex;
Buffer[byteIndex] &= ~bitIndexer;
if (value)
Buffer[byteIndex] |= bitIndexer;
return true;
}