feat(Core): detach Uuid from Math, add CheckedBits and portable Hash (M-CORE-02, M-CORE-03)
This commit is contained in:
1 parent
8d28c7e3c4
commit
cbc900412b
9 files changed
+555
-117
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#include <Void/Core/Bits.hpp>
|
||||
#include <Void/Core/CheckedBits.hpp>
|
||||
#include <Void/Core/Hash.hpp>
|
||||
#include <Void/Core/Meta.hpp>
|
||||
#include <Void/Core/Uuid.hpp>
|
||||
|
||||
#include <random>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::mt19937_64 rng{7};
|
||||
const auto u = Void::Uuid::v4(rng);
|
||||
const auto chars = Void::Uuid::format_chars(u);
|
||||
const auto reparsed =
|
||||
Void::Uuid::parse(std::string_view{chars.data(), chars.size()});
|
||||
if (!reparsed || *reparsed != u) {
|
||||
return 1;
|
||||
}
|
||||
const auto aligned = Void::Bits::checked_align_up(13u, 8u);
|
||||
if (!aligned || *aligned != 16u) {
|
||||
return 1;
|
||||
}
|
||||
const auto h = Void::Hash::fnv1a64("core-only");
|
||||
return h != 0 ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user