实现基本内存操作 Linux 平台测试

This commit is contained in:
2021-10-05 18:33:18 +08:00
parent 7361a673e4
commit f53211ef50
11 changed files with 330 additions and 26 deletions

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreTypes.h"
NS_REDCRAFT_BEGIN
NS_BEGIN(Math)
template <typename T>
static constexpr FORCEINLINE T Abs(const T A)
{
return (A >= (T)0) ? A : -A;
}
template <typename T>
static constexpr FORCEINLINE T Sign(const T A)
{
return (A > (T)0) ? (T)1 : ((A < (T)0) ? (T)-1 : (T)0);
}
template <typename T>
static constexpr FORCEINLINE T Max(const T A, const T B)
{
return (A >= B) ? A : B;
}
template <typename T>
static constexpr FORCEINLINE T Min(const T A, const T B)
{
return (A <= B) ? A : B;
}
NS_END(Math)
NS_REDCRAFT_END