mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-02 13:01:18 +12:00
Fix Mac build for Xcode 16.3 (#1558)
This commit is contained in:
parent
61484598fc
commit
f801fc1fe8
1 changed files with 86 additions and 0 deletions
|
@ -2,6 +2,92 @@
|
||||||
#include "boost/nowide/convert.hpp"
|
#include "boost/nowide/convert.hpp"
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
|
|
||||||
|
// Definition for removed templates in Apple Clang 17
|
||||||
|
#if defined(__apple_build_version__) && (__apple_build_version__ >= 17000000)
|
||||||
|
namespace std {
|
||||||
|
template<>
|
||||||
|
struct char_traits<uint16be> {
|
||||||
|
using char_type = uint16be;
|
||||||
|
using int_type = int;
|
||||||
|
using off_type = streamoff;
|
||||||
|
using pos_type = streampos;
|
||||||
|
using state_type = mbstate_t;
|
||||||
|
|
||||||
|
static inline void constexpr assign(char_type& c1, const char_type& c2) noexcept {
|
||||||
|
c1 = c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr bool eq(char_type c1, char_type c2) noexcept {
|
||||||
|
return c1 == c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr bool lt(char_type c1, char_type c2) noexcept {
|
||||||
|
return c1 < c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n) {
|
||||||
|
for (; n; --n, ++s1, ++s2) {
|
||||||
|
if (lt(*s1, *s2)) return -1;
|
||||||
|
if (lt(*s2, *s1)) return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr size_t length(const char_type* s) {
|
||||||
|
size_t len = 0;
|
||||||
|
for (; !eq(*s, char_type(0)); ++s) ++len;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr const char_type* find(const char_type* s, size_t n, const char_type& a) {
|
||||||
|
for (; n; --n) {
|
||||||
|
if (eq(*s, a))
|
||||||
|
return s;
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n) {
|
||||||
|
if (n == 0) return s1;
|
||||||
|
return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n) {
|
||||||
|
if (n == 0) return s1;
|
||||||
|
return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr char_type* assign(char_type* s, size_t n, char_type a) {
|
||||||
|
char_type* r = s;
|
||||||
|
for (; n; --n, ++s)
|
||||||
|
assign(*s, a);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr char_type to_char_type(int_type c) noexcept {
|
||||||
|
return char_type(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr int_type to_int_type(char_type c) noexcept {
|
||||||
|
return int_type(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr bool eq_int_type(int_type c1, int_type c2) noexcept {
|
||||||
|
return c1 == c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr int_type eof() noexcept {
|
||||||
|
return static_cast<int_type>(EOF);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline constexpr int_type not_eof(int_type c) noexcept {
|
||||||
|
return eq_int_type(c, eof()) ? ~eof() : c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// todo - move the Cafe/PPC specific parts to CafeString.h eventually
|
// todo - move the Cafe/PPC specific parts to CafeString.h eventually
|
||||||
namespace StringHelpers
|
namespace StringHelpers
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue