diff --git a/source/thirdparty/include/fix16.h b/source/thirdparty/include/fix16.h index f02a4d41f..c4a5ce408 100644 --- a/source/thirdparty/include/fix16.h +++ b/source/thirdparty/include/fix16.h @@ -1,9 +1,6 @@ #ifndef __libfixmath_fix16_h__ #define __libfixmath_fix16_h__ -#include "compat.h" - - /* These options may let the optimizer to remove some calls to the functions. * Refer to http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html @@ -24,18 +21,18 @@ typedef int32_t fix16_t; -static CONSTEXPR const fix16_t FIX16_MAX = 0x7FFFFFFF; /*!< the maximum value of fix16_t */ -static CONSTEXPR const fix16_t FIX16_MIN = 0x80000000; /*!< the minimum value of fix16_t */ -static CONSTEXPR const fix16_t FIX16_OVERFLOW = 0x80000000; /*!< the value used to indicate overflows when FIXMATH_NO_OVERFLOW is not specified */ +static const fix16_t FIX16_MAX = 0x7FFFFFFF; /*!< the maximum value of fix16_t */ +static const fix16_t FIX16_MIN = 0x80000000; /*!< the minimum value of fix16_t */ +static const fix16_t FIX16_OVERFLOW = 0x80000000; /*!< the value used to indicate overflows when FIXMATH_NO_OVERFLOW is not specified */ -static CONSTEXPR const fix16_t fix16_one = 0x00010000; /*!< fix16_t value of 1 */ +static const fix16_t fix16_one = 0x00010000; /*!< fix16_t value of 1 */ /* Conversion functions between fix16_t and float/integer. * These are inlined to allow compiler to optimize away constant numbers */ -static FORCE_INLINE CONSTEXPR fix16_t fix16_from_int(int a) { return a * fix16_one; } -static FORCE_INLINE CONSTEXPR float fix16_to_float(fix16_t a) { return (float)a / fix16_one; } -static FORCE_INLINE CONSTEXPR double fix16_to_dbl(fix16_t a) { return (double)a / fix16_one; } +static inline constexpr fix16_t fix16_from_int(int a) { return a * fix16_one; } +static inline constexpr float fix16_to_float(fix16_t a) { return (float)a / fix16_one; } +static inline constexpr double fix16_to_dbl(fix16_t a) { return (double)a / fix16_one; } static inline constexpr int fix16_to_int(fix16_t a) { @@ -77,24 +74,24 @@ static inline fix16_t fix16_from_dbl(double a) */ #define F16(x) ((fix16_t)(((x) >= 0) ? ((x) * 65536.0 + 0.5) : ((x) * 65536.0 - 0.5))) -static FORCE_INLINE CONSTEXPR fix16_t fix16_abs(fix16_t x) +static inline constexpr fix16_t fix16_abs(fix16_t x) { return (x < 0 ? -x : x); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_floor(fix16_t x) +static inline constexpr fix16_t fix16_floor(fix16_t x) { return (x & 0xFFFF0000UL); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_ceil(fix16_t x) +static inline constexpr fix16_t fix16_ceil(fix16_t x) { return (x & 0xFFFF0000UL) + ((x & 0x0000FFFFUL) ? fix16_one : 0); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_min(fix16_t x, fix16_t y) +static inline constexpr fix16_t fix16_min(fix16_t x, fix16_t y) { return (x < y ? x : y); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_max(fix16_t x, fix16_t y) +static inline constexpr fix16_t fix16_max(fix16_t x, fix16_t y) { return (x > y ? x : y); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_clamp(fix16_t x, fix16_t lo, fix16_t hi) +static inline constexpr fix16_t fix16_clamp(fix16_t x, fix16_t lo, fix16_t hi) { return fix16_min(fix16_max(x, lo), hi); } /* Subtraction and addition with (optional) overflow detection. */ #ifdef FIXMATH_NO_OVERFLOW -static FORCE_INLINE CONSTEXPR fix16_t fix16_add(fix16_t inArg0, fix16_t inArg1) { return (inArg0 + inArg1); } -static FORCE_INLINE CONSTEXPR fix16_t fix16_sub(fix16_t inArg0, fix16_t inArg1) { return (inArg0 - inArg1); } +static inline constexpr fix16_t fix16_add(fix16_t inArg0, fix16_t inArg1) { return (inArg0 + inArg1); } +static inline constexpr fix16_t fix16_sub(fix16_t inArg0, fix16_t inArg1) { return (inArg0 - inArg1); } #else @@ -127,7 +124,7 @@ extern fix16_t fix16_sdiv(fix16_t inArg0, fix16_t inArg1) FIXMATH_FUNC_ATTRS; /*! Divides the first given fix16_t by the second and returns the remainder. */ -static FORCE_INLINE fix16_t fix16_mod(fix16_t x, fix16_t y) { return x %= y; } +static inline fix16_t fix16_mod(fix16_t x, fix16_t y) { return x %= y; } diff --git a/source/thirdparty/include/fix16_int64.h b/source/thirdparty/include/fix16_int64.h index e805effba..32574ba27 100644 --- a/source/thirdparty/include/fix16_int64.h +++ b/source/thirdparty/include/fix16_int64.h @@ -1,28 +1,28 @@ #ifndef __libfixmath_int64_h__ #define __libfixmath_int64_h__ -#include "compat.h" +#include -static FORCE_INLINE CONSTEXPR int64_t int64_const(int32_t hi, uint32_t lo) { return (((int64_t)hi << 32) | lo); } -static FORCE_INLINE CONSTEXPR int64_t int64_from_int32(int32_t x) { return (int64_t)x; } -static FORCE_INLINE CONSTEXPR int32_t int64_hi(int64_t x) { return (x >> 32); } -static FORCE_INLINE CONSTEXPR uint32_t int64_lo(int64_t x) { return (x & ((1ULL << 32) - 1)); } +static inline constexpr int64_t int64_const(int32_t hi, uint32_t lo) { return (((int64_t)hi << 32) | lo); } +static inline constexpr int64_t int64_from_int32(int32_t x) { return (int64_t)x; } +static inline constexpr int32_t int64_hi(int64_t x) { return (x >> 32); } +static inline constexpr uint32_t int64_lo(int64_t x) { return (x & ((1ULL << 32) - 1)); } -static FORCE_INLINE CONSTEXPR int64_t int64_add(int64_t x, int64_t y) { return (x + y); } -static FORCE_INLINE CONSTEXPR int64_t int64_neg(int64_t x) { return (-x); } -static FORCE_INLINE CONSTEXPR int64_t int64_sub(int64_t x, int64_t y) { return (x - y); } -static FORCE_INLINE CONSTEXPR int64_t int64_shift(int64_t x, int8_t y) { return (y < 0 ? (x >> -y) : (x << y)); } +static inline constexpr int64_t int64_add(int64_t x, int64_t y) { return (x + y); } +static inline constexpr int64_t int64_neg(int64_t x) { return (-x); } +static inline constexpr int64_t int64_sub(int64_t x, int64_t y) { return (x - y); } +static inline constexpr int64_t int64_shift(int64_t x, int8_t y) { return (y < 0 ? (x >> -y) : (x << y)); } -static FORCE_INLINE CONSTEXPR int64_t int64_mul_i32_i32(int32_t x, int32_t y) { return (x * y); } -static FORCE_INLINE CONSTEXPR int64_t int64_mul_i64_i32(int64_t x, int32_t y) { return (x * y); } +static inline constexpr int64_t int64_mul_i32_i32(int32_t x, int32_t y) { return (x * y); } +static inline constexpr int64_t int64_mul_i64_i32(int64_t x, int32_t y) { return (x * y); } -static FORCE_INLINE CONSTEXPR int64_t int64_div_i64_i32(int64_t x, int32_t y) { return (x / y); } +static inline constexpr int64_t int64_div_i64_i32(int64_t x, int32_t y) { return (x / y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_eq(int64_t x, int64_t y) { return (x == y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_ne(int64_t x, int64_t y) { return (x != y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_gt(int64_t x, int64_t y) { return (x > y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_ge(int64_t x, int64_t y) { return (x >= y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_lt(int64_t x, int64_t y) { return (x < y); } -static FORCE_INLINE CONSTEXPR int int64_cmp_le(int64_t x, int64_t y) { return (x <= y); } +static inline constexpr int int64_cmp_eq(int64_t x, int64_t y) { return (x == y); } +static inline constexpr int int64_cmp_ne(int64_t x, int64_t y) { return (x != y); } +static inline constexpr int int64_cmp_gt(int64_t x, int64_t y) { return (x > y); } +static inline constexpr int int64_cmp_ge(int64_t x, int64_t y) { return (x >= y); } +static inline constexpr int int64_cmp_lt(int64_t x, int64_t y) { return (x < y); } +static inline constexpr int int64_cmp_le(int64_t x, int64_t y) { return (x <= y); } #endif diff --git a/source/thirdparty/src/md4.cpp b/source/thirdparty/src/md4.cpp index 43b8a4600..4fce2546f 100644 --- a/source/thirdparty/src/md4.cpp +++ b/source/thirdparty/src/md4.cpp @@ -30,7 +30,6 @@ typedef unsigned short UINT2; typedef unsigned int UINT4; #include "md4.h" -#include "compat.h" /* Constants for MD4Transform routine. */ @@ -50,7 +49,7 @@ typedef unsigned int UINT4; static void MD4Transform(UINT4 [4], const unsigned char [64]); static void Encode(unsigned char *, const UINT4 *, unsigned int); static void Decode(UINT4 *, const unsigned char *, unsigned int); -#define MD4_memcpy Bmemcpy +#define MD4_memcpy memcpy #define MD4_memset memset static unsigned char PADDING[64] =