Fix utility not using the correct functions for runtime
This commit is contained in:
parent
31327248e0
commit
1165165657
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#if defined(__cpp_if_consteval)
|
#if defined(__cpp_if_consteval)
|
||||||
#define REXY_if_consteval if consteval
|
#define REXY_if_consteval if consteval
|
||||||
#define REXY_if_consteval if not consteval
|
#define REXY_if_not_consteval if not consteval
|
||||||
#elif defined(__cpp_lib_is_constant_evaluated)
|
#elif defined(__cpp_lib_is_constant_evaluated)
|
||||||
#include <type_traits> //is_constant_evaluated
|
#include <type_traits> //is_constant_evaluated
|
||||||
#define REXY_if_consteval if(std::is_constant_evaluated())
|
#define REXY_if_consteval if(std::is_constant_evaluated())
|
||||||
|
|||||||
@ -99,7 +99,7 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
constexpr int strcmp(const T* l, const T* r)noexcept{
|
constexpr int strcmp(const T* l, const T* r)noexcept{
|
||||||
REXY_if_consteval{
|
REXY_if_not_consteval{
|
||||||
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
||||||
return std::strcmp(l, r);
|
return std::strcmp(l, r);
|
||||||
}else if constexpr(std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
}else if constexpr(std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
||||||
@ -111,7 +111,7 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
constexpr int strncmp(const T* l, const T* r, std::size_t max)noexcept{
|
constexpr int strncmp(const T* l, const T* r, std::size_t max)noexcept{
|
||||||
REXY_if_consteval{
|
REXY_if_not_consteval{
|
||||||
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
||||||
return std::strncmp(l, r, max);
|
return std::strncmp(l, r, max);
|
||||||
}else if constexpr (std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
}else if constexpr (std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
||||||
@ -123,7 +123,7 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
template<class T, class Compare>
|
template<class T, class Compare>
|
||||||
constexpr int strncmp(const T* l, const T* r, std::size_t max, Compare cmp)noexcept{
|
constexpr int strncmp(const T* l, const T* r, std::size_t max, Compare cmp)noexcept{
|
||||||
REXY_if_consteval{
|
REXY_if_not_consteval{
|
||||||
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
if constexpr(std::is_same_v<std::remove_cvref_t<T>,char>){
|
||||||
return std::strncmp(l, r, max);
|
return std::strncmp(l, r, max);
|
||||||
}else if constexpr (std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
}else if constexpr (std::is_same_v<std::remove_cvref_t<T>,wchar_t>){
|
||||||
@ -139,7 +139,7 @@ namespace rexy{
|
|||||||
return *l - *r;
|
return *l - *r;
|
||||||
}
|
}
|
||||||
constexpr void memcpy(void* l, const void* r, std::size_t n){
|
constexpr void memcpy(void* l, const void* r, std::size_t n){
|
||||||
REXY_if_consteval{
|
REXY_if_not_consteval{
|
||||||
std::memcpy(l, r, n);
|
std::memcpy(l, r, n);
|
||||||
}else{
|
}else{
|
||||||
char* ld = static_cast<char*>(l);
|
char* ld = static_cast<char*>(l);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user