includes/std: Added MagicSearch and Reinterpreter helper type

This commit is contained in:
Nik
2022-10-09 17:37:37 +02:00
committed by GitHub
parent 16eebea2fb
commit f75703fd2b

View File

@@ -47,4 +47,26 @@ namespace std::mem {
return builtin::std::mem::read_string(address, size);
};
struct MagicSearch<auto Magic, T> {
if ($ < (std::mem::size() - std::string::length(Magic) - 1)) {
char __potentialMagic__[std::string::length(Magic)] [[hidden, no_unique_address]];
if (__potentialMagic__ == Magic) {
T data [[inline]];
} else {
padding[1];
continue;
}
} else {
padding[1];
continue;
}
};
union Reinterpreter<From, To> {
From from;
To to;
};
}