Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
varqox committed May 18, 2024
2 parents 0d0f1a3 + e89652d commit f3c6c34
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions subprojects/simlib/include/simlib/kernel_version.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <array>
#include <cstdint>
#include <cstring>
#include <simlib/errmsg.hh>
Expand All @@ -17,15 +16,21 @@ struct KernelVersion {
};

constexpr bool operator==(const KernelVersion& a, const KernelVersion& b) noexcept {
return std::array{a.major, a.minor, a.patch} == std::array{b.major, b.minor, b.patch};
return a.major == b.major && a.minor == b.minor && a.patch == b.patch;
}

constexpr bool operator!=(const KernelVersion& a, const KernelVersion& b) noexcept {
return !(a == b);
}

constexpr bool operator<(const KernelVersion& a, const KernelVersion& b) noexcept {
return std::array{a.major, a.minor, a.patch} < std::array{b.major, b.minor, b.patch};
if (a.major != b.major) {
return a.major < b.major;
}
if (a.minor != b.minor) {
return a.minor < b.minor;
}
return a.patch < b.patch;
}

constexpr bool operator>(const KernelVersion& a, const KernelVersion& b) noexcept { return b < a; }
Expand Down

0 comments on commit f3c6c34

Please sign in to comment.