Squashed 'deps/nostalgia/' changes from cb304ecf..312097a7

312097a7 [ox/std] Fix implementation of std cmp functions
a40198ab [nostalgia] Update release-d2025.05.2 release notes
52d8c0bd [nostalgia/gfx] Replace static_cast compare with std::cmp_equal
c19d7f4e [nostalgia] Add .vs and cmake-build-* to .gitignore
159b7e7e [buildcore] Make pybb cmake_build specify --config debug/release
c93eec4f [teagba] Make cstart.cpp only compile if GCC
e7e7a223 [nostalgia/sample_project] Make sample_project exempt from autocrlf
26d5048e [ox/fs] Fix new build error in MSVC (VS 17.14)
3b8f97cc [nostalgia/gfx] Cleanup
f1e68e0a [nostalgia/gfx/studio/tilesheet] Fix overrun errors when switching subsheets, clear selection on switch
d6e4ab7a [keel] Cleanup

git-subtree-dir: deps/nostalgia
git-subtree-split: 312097a7991194ce36e7c2e357e7e3a51d916767
This commit is contained in:
2025-05-23 03:23:17 -05:00
parent a4a00c99d0
commit e90dd88747
15 changed files with 89 additions and 61 deletions

View File

@ -24,9 +24,6 @@ enum class FileAddressType: int8_t {
Inode,
};
template<typename T>
constexpr Error model(T *h, CommonPtrWith<class FileAddress> auto *fa) noexcept;
class FileAddress {
template<typename T>

View File

@ -32,9 +32,9 @@ constexpr bool cmp_equal(T const t, U const u) noexcept {
if constexpr(ox::is_signed_v<T> == ox::is_signed_v<U>) {
return t == u;
} else if constexpr(ox::is_signed_v<T>) {
return ox::Signed<T>{t} == u;
return t >= 0 && static_cast<ox::Unsigned<T>>(t) == u;
} else {
return t == ox::Signed<U>{u};
return u >= 0 && t == static_cast<ox::Unsigned<U>>(u);
}
}
@ -43,9 +43,9 @@ constexpr bool cmp_less(T const t, U const u) noexcept {
if constexpr(ox::is_signed_v<T> == ox::is_signed_v<U>) {
return t < u;
} else if constexpr(ox::is_signed_v<T>) {
return ox::Signed<T>{t} < u;
return t < 0 || static_cast<ox::Unsigned<T>>(t) < u;
} else {
return t < ox::Signed<U>{u};
return u >= 0 && t < static_cast<ox::Unsigned<U>>(u);
}
}
@ -69,6 +69,13 @@ constexpr bool cmp_greater_equal(T const t, U const u) noexcept {
return !std::cmp_less(t, u);
}
static_assert(cmp_less(-1, 5u));
static_assert(!cmp_less(5u, -1));
static_assert(cmp_equal(5u, 5));
static_assert(cmp_equal(5, 5u));
static_assert(!cmp_equal(-5, 5u));
static_assert(!cmp_equal(4u, 5u));
}
#endif