From 8c4bcc13d79ef56ba77815843a5b5da2f3aba35a Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:49:41 +0200 Subject: [PATCH] Recast: move bit cell code to SharedCommon --- src/thirdparty/recast/Shared/Include/SharedCommon.h | 9 ++++++++- src/thirdparty/recast/Shared/Include/SharedMath.h | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/thirdparty/recast/Shared/Include/SharedCommon.h b/src/thirdparty/recast/Shared/Include/SharedCommon.h index cb50ab17..88bbd730 100644 --- a/src/thirdparty/recast/Shared/Include/SharedCommon.h +++ b/src/thirdparty/recast/Shared/Include/SharedCommon.h @@ -20,7 +20,9 @@ #define RECASTDETOURCOMMON_H #include "Shared/Include/SharedMath.h" -#include + +/// The total number of bits in an bit cell integer. +static const int RD_BITS_PER_BIT_CELL = 32; /** @defgroup shared Shared @@ -40,6 +42,11 @@ feature to find minor members. /// @param [in] _ Unused parameter template void rdIgnoreUnused(const T&) { } +/// Tests a specific bit in a bit cell +/// @param[in] i The bit number +/// @return The offset mask for the bit. +inline int rdBitCellBit(const int i) { return (1 << ((i) & (RD_BITS_PER_BIT_CELL-1))); } + /// Swaps the values of the two parameters. /// @param[in,out] a Value A /// @param[in,out] b Value B diff --git a/src/thirdparty/recast/Shared/Include/SharedMath.h b/src/thirdparty/recast/Shared/Include/SharedMath.h index 15b3c3b0..b60bfd2c 100644 --- a/src/thirdparty/recast/Shared/Include/SharedMath.h +++ b/src/thirdparty/recast/Shared/Include/SharedMath.h @@ -12,12 +12,6 @@ Members in this module are wrappers around the standard math library /// The value of PI used by Recast & Detour. static const float RD_PI = 3.14159265f; -/// The total number of bits in an bit cell integer. -static const int RD_BITS_PER_BIT_CELL = 32; - -// TODO: move to common! -inline int rdBitCellBit(const int bitNum) { return (1 << ((bitNum) & (RD_BITS_PER_BIT_CELL-1))); } - inline float rdMathFabsf(float x) { return fabsf(x); } inline float rdMathSqrtf(float x) { return sqrtf(x); } inline float rdMathFloorf(float x) { return floorf(x); }