mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Fixed build.
This commit is contained in:
@@ -241,7 +241,7 @@ namespace bx
|
||||
const uint32_t tmpF = uint32_add(tmpD, tmpE);
|
||||
const uint32_t result = uint32_and(tmpF, 0x3f);
|
||||
|
||||
return result;
|
||||
return uint8_t(result);
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
|
||||
@@ -254,8 +254,8 @@ namespace bx
|
||||
const uint32_t lo = uint32_t(_val&UINT32_MAX);
|
||||
const uint32_t hi = uint32_t(_val>>32);
|
||||
|
||||
return uint32_cntbits(lo)
|
||||
+ uint32_cntbits(hi)
|
||||
return countBits<uint32_t>(lo)
|
||||
+ countBits<uint32_t>(hi)
|
||||
;
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace bx
|
||||
const uint32_t tmpA = uint32_not(tmp9);
|
||||
const uint32_t result = uint32_cntbits(tmpA);
|
||||
|
||||
return result;
|
||||
return uint8_t(result);
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
|
||||
@@ -303,8 +303,8 @@ namespace bx
|
||||
return 0 == _val ? 64 : __builtin_clzll(_val);
|
||||
#else
|
||||
return _val & UINT64_C(0xffffffff00000000)
|
||||
? uint32_cntlz(uint32_t(_val>>32) )
|
||||
: uint32_cntlz(uint32_t(_val) ) + 32
|
||||
? countLeadingZeros<uint32_t>(uint32_t(_val>>32) )
|
||||
: countLeadingZeros<uint32_t>(uint32_t(_val) ) + 32
|
||||
;
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
@@ -333,7 +333,7 @@ namespace bx
|
||||
const uint32_t tmp2 = uint32_and(tmp0, tmp1);
|
||||
const uint32_t result = uint32_cntbits(tmp2);
|
||||
|
||||
return result;
|
||||
return uint8_t(result);
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
|
||||
@@ -344,8 +344,8 @@ namespace bx
|
||||
return 0 == _val ? 64 : __builtin_ctzll(_val);
|
||||
#else
|
||||
return _val & UINT64_C(0xffffffff)
|
||||
? uint32_cnttz(uint32_t(_val) )
|
||||
: uint32_cnttz(uint32_t(_val>>32) ) + 32
|
||||
? countTrailingZeros<uint32_t>(uint32_t(_val) )
|
||||
: countTrailingZeros<uint32_t>(uint32_t(_val>>32) ) + 32
|
||||
;
|
||||
#endif // BX_COMPILER_*
|
||||
}
|
||||
@@ -356,12 +356,12 @@ namespace bx
|
||||
return countTrailingZeros<unsigned long long>(_val);
|
||||
}
|
||||
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(uint8_t _val) { return bx::min(8u, countTrailingZeros<uint32_t>(_val) ); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int8_t _val) { return countTrailingZeros<uint8_t >(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(uint16_t _val) { return bx::min(16u, countTrailingZeros<uint32_t>(_val) ); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int16_t _val) { return countTrailingZeros<uint16_t>(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int32_t _val) { return countTrailingZeros<uint32_t>(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int64_t _val) { return countTrailingZeros<uint64_t>(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(uint8_t _val) { return bx::min<uint8_t>(8, countTrailingZeros<uint32_t>(_val) ); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int8_t _val) { return countTrailingZeros<uint8_t >(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(uint16_t _val) { return bx::min<uint8_t>(16, countTrailingZeros<uint32_t>(_val) ); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int16_t _val) { return countTrailingZeros<uint16_t>(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int32_t _val) { return countTrailingZeros<uint32_t>(_val); }
|
||||
template<> inline BX_CONSTEXPR_FUNC uint8_t countTrailingZeros(int64_t _val) { return countTrailingZeros<uint64_t>(_val); }
|
||||
|
||||
template<typename Ty>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t findFirstSet(Ty _x)
|
||||
|
||||
@@ -96,13 +96,13 @@ namespace bx
|
||||
|
||||
DiyFp Normalize() const
|
||||
{
|
||||
uint32_t s = uint64_cntlz(f);
|
||||
uint8_t s = countLeadingZeros(f);
|
||||
return DiyFp(f << s, e - s);
|
||||
}
|
||||
|
||||
DiyFp NormalizeBoundary() const
|
||||
{
|
||||
uint32_t index = uint64_cntlz(f);
|
||||
uint8_t index = countLeadingZeros(f);
|
||||
return DiyFp (f << index, e - index);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,16 +217,15 @@ namespace bx
|
||||
*_inOutSize = uint32_t(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#elif BX_PLATFORM_OSX
|
||||
uint32_t len = *_inOutSize;
|
||||
bool result = _NSGetExecutablePath(_out, &len);
|
||||
if (0 == result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif // BX_PLATFORM_*
|
||||
|
||||
return 0 == result;
|
||||
#else
|
||||
return false;
|
||||
#endif // BX_PLATFORM_*
|
||||
}
|
||||
|
||||
static bool getHomePath(char* _out, uint32_t* _inOutSize)
|
||||
|
||||
@@ -22,8 +22,8 @@ TEST_CASE("isFinite, isInfinite, isNan", "[math]")
|
||||
REQUIRE(::__isfinitef(u.f) == bx::isFinite(u.f) );
|
||||
REQUIRE(::__isinff(u.f) == bx::isInfinite(u.f) );
|
||||
#elif BX_COMPILER_MSVC
|
||||
REQUIRE(!!::_isnanf(u.f) == bx::isNan(u.f));
|
||||
REQUIRE(!!::_finitef(u.f) == bx::isFinite(u.f));
|
||||
REQUIRE(!!::isnan(u.f) == bx::isNan(u.f));
|
||||
REQUIRE(!!::isfinite(u.f) == bx::isFinite(u.f));
|
||||
REQUIRE(!!::isinf(u.f) == bx::isInfinite(u.f));
|
||||
#else
|
||||
REQUIRE(::isnanf(u.f) == bx::isNan(u.f) );
|
||||
@@ -75,14 +75,14 @@ TEST_CASE("ceilLog2", "[math]")
|
||||
REQUIRE(ii == bx::ceilLog2(uint8_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint16_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint32_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint64_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint64_t(1llu<<ii) ) );
|
||||
}
|
||||
|
||||
for (; ii < 16; ++ii)
|
||||
{
|
||||
REQUIRE(ii == bx::ceilLog2(uint16_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint32_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint64_t(1<<ii) ) );
|
||||
REQUIRE(ii == bx::ceilLog2(uint64_t(1llu<<ii) ) );
|
||||
}
|
||||
|
||||
for (; ii < 32; ++ii)
|
||||
|
||||
Reference in New Issue
Block a user