mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
fixes
bits: avoid warning, document ceil_log2 corner case cpu, x86_x64: remove unused cpu_MemoryFence wdbg_heap: avoid warning test_bits: fix incorrect test values TerrainOverlay: fix use of struct vs. class, correct unintended search&destroy of intended->ssize_tended (LOL) This was SVN commit r6119.
This commit is contained in:
+3
-2
@@ -51,7 +51,7 @@ T bit_mask(size_t numBits)
|
||||
// note: the perhaps more intuitive (1 << numBits)-1 cannot
|
||||
// handle numBits == bitsInT, but this implementation does.
|
||||
const T bitsInT = sizeof(T)*CHAR_BIT;
|
||||
T mask = ~T(0);
|
||||
T mask = T(~0);
|
||||
mask >>= T(bitsInT-numBits);
|
||||
return mask;
|
||||
}
|
||||
@@ -111,7 +111,8 @@ bool is_pow2(T n)
|
||||
* ceil(log2(x))
|
||||
*
|
||||
* @param x (unsigned integer)
|
||||
* @return ceiling of the base-2 logarithm (i.e. rounded up).
|
||||
* @return ceiling of the base-2 logarithm (i.e. rounded up) or
|
||||
* zero if the input is zero.
|
||||
**/
|
||||
template<typename T>
|
||||
size_t ceil_log2(T x)
|
||||
|
||||
@@ -64,11 +64,6 @@ LIB_API void cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment);
|
||||
**/
|
||||
LIB_API void cpu_Serialize();
|
||||
|
||||
/**
|
||||
* enforce strong memory ordering.
|
||||
**/
|
||||
LIB_API void cpu_MemoryFence();
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// misc
|
||||
|
||||
@@ -823,7 +823,7 @@ static void PrintCallStack(const uintptr_t* callers, size_t numCallers)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
static int __cdecl ReportHook(int reportType, char* message, int* out)
|
||||
{
|
||||
UNUSED2(reportType);
|
||||
@@ -886,6 +886,7 @@ static int __cdecl ReportHook(int reportType, char* message, int* out)
|
||||
wdbg_assert(0); // unreachable
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -509,14 +509,6 @@ void x86_x64_DebugBreak()
|
||||
}
|
||||
|
||||
|
||||
// enforce strong memory ordering.
|
||||
void cpu_MemoryFence()
|
||||
{
|
||||
if(x86_x64_cap(X86_X64_CAP_SSE2))
|
||||
_mm_mfence();
|
||||
}
|
||||
|
||||
|
||||
void cpu_Serialize()
|
||||
{
|
||||
x86_x64_CpuidRegs regs;
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
void test_round_up_to_pow2()
|
||||
{
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(0u), 1u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(1u), 2u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(1u), 1u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(127u), 128u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(128u), 256u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(128u), 128u);
|
||||
TS_ASSERT_EQUALS(round_up_to_pow2(129u), 256u);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#ifndef INCLUDED_TERRAINOVERLAY
|
||||
#define INCLUDED_TERRAINOVERLAY
|
||||
|
||||
class CColor;
|
||||
struct CColor;
|
||||
class CTerrain;
|
||||
|
||||
/**
|
||||
* Base class for (relatively) simple drawing of
|
||||
* data onto terrain tiles, ssize_tended for debugging purposes and for the Atlas
|
||||
* data onto terrain tiles, intended for debugging purposes and for the Atlas
|
||||
* editor (hence not trying to be very efficient).
|
||||
* <p>
|
||||
* To start drawing a terrain overlay, first create a subclass of TerrainOverlay.
|
||||
|
||||
Reference in New Issue
Block a user