IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
kVersion.hpp
Go to the documentation of this file.
1
11
12
13#pragma once
14
15
16// IgrOS-Kernel arch
17#include <arch/types.hpp>
18
19
20
26namespace igros::klib {
27
28
34 class kVersion final {
35
36 constexpr static auto VERSION_MAJOR {static_cast<igros_byte_t>(IGROS_GIT_VERSION_MAJOR)};
37 constexpr static auto VERSION_MINOR {static_cast<igros_byte_t>(IGROS_GIT_VERSION_MINOR)};
38 constexpr static auto VERSION_PATCH {static_cast<igros_word_t>(IGROS_GIT_VERSION_PATCH)};
39 constexpr static auto VERSION_BUILD {static_cast<igros_dword_t>(IGROS_GIT_VERSION_BUILD)};
40
41 // cppcheck-suppress unusedStructMember ; release name, kept with version fields
42 constexpr static auto VERSION_NAME {"BETA"};
43
44
45 public:
46
48 [[nodiscard]]
49 constexpr static auto value() noexcept -> igros_quad_t;
50
52 [[nodiscard]]
53 constexpr static auto text() noexcept -> const char*;
54 };
55
56
63 [[nodiscard]]
64 constexpr auto kVersion::value() noexcept -> igros_quad_t {
65 // Layout from high to low bits: major (8 bits), minor (8 bits), patch (16 bits), build (32 bits)
66 return static_cast<igros_quad_t>(VERSION_BUILD) | ((static_cast<igros_quad_t>(VERSION_PATCH) << 0_usize) | (static_cast<igros_quad_t>(VERSION_MINOR) << 16_usize) | (static_cast<igros_quad_t>(VERSION_MAJOR) << 24_usize)) << 32_usize;
67 }
68
69
75 [[nodiscard]]
76 constexpr auto kVersion::text() noexcept -> const char* {
77 return "v" IGROS_GIT_VERSION;
78 }
79
80
81} // namespace igros::klib
82
Kernel version class.
Definition kVersion.hpp:34
static constexpr auto value() noexcept -> igros_quad_t
Kernel version to integer.
Definition kVersion.hpp:64
static constexpr auto VERSION_BUILD
Kernel version build.
Definition kVersion.hpp:39
static constexpr auto VERSION_MAJOR
Kernel version major.
Definition kVersion.hpp:36
static constexpr auto VERSION_PATCH
Kernel version patch.
Definition kVersion.hpp:38
static constexpr auto text() noexcept -> const char *
Kernel version to string.
Definition kVersion.hpp:76
static constexpr auto VERSION_MINOR
Kernel version minor.
Definition kVersion.hpp:37
static constexpr auto VERSION_NAME
Kernel version name.
Definition kVersion.hpp:42
std::uint16_t igros_word_t
16-bit unsigned integer
Definition types.hpp:42
std::uint8_t igros_byte_t
8-bit unsigned integer
Definition types.hpp:41
std::uint32_t igros_dword_t
32-bit unsigned integer
Definition types.hpp:43
std::uint64_t igros_quad_t
64-bit unsigned integer
Definition types.hpp:44
Freestanding kernel library: printing, math, alignment, flags, strings.
Common C++ types redefinition.