mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Removed BX_STATIC_ASSERT. Not needed in C++17.
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
BX_ERROR_USE_TEMP_WHEN_NULL(_ptr); \
|
||||
bx::ErrorScope bxErrorScope(const_cast<bx::Error*>(&tmpError), "" __VA_ARGS__)
|
||||
|
||||
#define BX_ERROR_RESULT(_err, _code) \
|
||||
BX_STATIC_ASSERT(_code != 0, "ErrorCode 0 is reserved!"); \
|
||||
#define BX_ERROR_RESULT(_err, _code) \
|
||||
static_assert(_code != 0, "ErrorCode 0 is reserved!"); \
|
||||
static constexpr bx::ErrorResult _err = { _code }
|
||||
|
||||
namespace bx
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace bx
|
||||
template<typename HashT, typename Ty>
|
||||
inline uint32_t hash(const Ty& _data)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
return hash<HashT>(&_data, sizeof(Ty) );
|
||||
}
|
||||
|
||||
|
||||
@@ -668,28 +668,28 @@ namespace bx
|
||||
template<typename Ty>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t findFirstSet(Ty _val)
|
||||
{
|
||||
BX_STATIC_ASSERT(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
static_assert(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
return Ty(0) == _val ? uint8_t(0) : countTrailingZeros<Ty>(_val) + 1;
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t findLastSet(Ty _val)
|
||||
{
|
||||
BX_STATIC_ASSERT(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
static_assert(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
return Ty(0) == _val ? uint8_t(0) : sizeof(Ty)*8 - countLeadingZeros<Ty>(_val);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t ceilLog2(Ty _a)
|
||||
{
|
||||
BX_STATIC_ASSERT(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
static_assert(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
return Ty(_a) < Ty(1) ? Ty(0) : sizeof(Ty)*8 - countLeadingZeros<Ty>(_a - 1);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline BX_CONSTEXPR_FUNC uint8_t floorLog2(Ty _a)
|
||||
{
|
||||
BX_STATIC_ASSERT(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
static_assert(isInteger<Ty>(), "Type Ty must be of integer type!");
|
||||
return Ty(_a) < Ty(1) ? Ty(0) : sizeof(Ty)*8 - 1 - countLeadingZeros<Ty>(_a);
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace bx
|
||||
inline int32_t read(ReaderI* _reader, Ty& _value, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
return _reader->read(&_value, sizeof(Ty), _err);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace bx
|
||||
inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
Ty value;
|
||||
int32_t result = _reader->read(&value, sizeof(Ty), _err);
|
||||
_value = toHostEndian(value, _fromLittleEndian);
|
||||
@@ -322,7 +322,7 @@ namespace bx
|
||||
inline int32_t write(WriterI* _writer, const Ty& _value, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
return _writer->write(&_value, sizeof(Ty), _err);
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace bx
|
||||
inline int32_t writeLE(WriterI* _writer, const Ty& _value, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
Ty value = toLittleEndian(_value);
|
||||
int32_t result = _writer->write(&value, sizeof(Ty), _err);
|
||||
return result;
|
||||
@@ -363,7 +363,7 @@ namespace bx
|
||||
inline int32_t writeBE(WriterI* _writer, const Ty& _value, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
Ty value = toBigEndian(_value);
|
||||
int32_t result = _writer->write(&value, sizeof(Ty), _err);
|
||||
return result;
|
||||
@@ -414,7 +414,7 @@ namespace bx
|
||||
inline int32_t peek(ReaderSeekerI* _reader, Ty& _value, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_STATIC_ASSERT(isTriviallyCopyable<Ty>() );
|
||||
static_assert(isTriviallyCopyable<Ty>() );
|
||||
return peek(_reader, &_value, sizeof(Ty), _err);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,28 +44,28 @@ namespace bx
|
||||
template<typename Ty>
|
||||
inline void quickSort(void* _data, uint32_t _num, uint32_t _stride, const ComparisonFn _fn)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
quickSort(_data, _num, _stride, _fn);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline void quickSort(Ty* _data, uint32_t _num, const ComparisonFn _fn)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
quickSort( (void*)_data, _num, sizeof(Ty), _fn);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline uint32_t unique(void* _data, uint32_t _num, uint32_t _stride, const ComparisonFn _fn)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
return unique(_data, _num, _stride, _fn);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline uint32_t unique(Ty* _data, uint32_t _num, const ComparisonFn _fn)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Element type must be trivially move assignable");
|
||||
return unique( (void*)_data, _num, sizeof(Ty), _fn);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ done:
|
||||
template <typename Ty>
|
||||
inline void radixSort(uint32_t* _keys, uint32_t* _tempKeys, Ty* _values, Ty* _tempValues, uint32_t _size)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Sort element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Sort element type must be trivially move assignable");
|
||||
|
||||
uint32_t* keys = _keys;
|
||||
uint32_t* tempKeys = _tempKeys;
|
||||
@@ -325,7 +325,7 @@ done:
|
||||
template <typename Ty>
|
||||
inline void radixSort(uint64_t* _keys, uint64_t* _tempKeys, Ty* _values, Ty* _tempValues, uint32_t _size)
|
||||
{
|
||||
BX_STATIC_ASSERT(isTriviallyMoveAssignable<Ty>(), "Sort element type must be trivially move assignable");
|
||||
static_assert(isTriviallyMoveAssignable<Ty>(), "Sort element type must be trivially move assignable");
|
||||
|
||||
uint64_t* keys = _keys;
|
||||
uint64_t* tempKeys = _tempKeys;
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace bx
|
||||
template<typename Ty>
|
||||
inline constexpr Ty&& forward(RemoveReferenceType<Ty>&& _a)
|
||||
{
|
||||
BX_STATIC_ASSERT(!isLvalueReference<Ty>(), "Can not forward an Rvalue as an Lvalue.");
|
||||
static_assert(!isLvalueReference<Ty>(), "Can not forward an Rvalue as an Lvalue.");
|
||||
return static_cast<Ty&&>(_a);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,9 +88,6 @@
|
||||
///
|
||||
#define BX_CONSTEXPR_FUNC constexpr BX_CONST_FUNC
|
||||
|
||||
///
|
||||
#define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__)
|
||||
|
||||
///
|
||||
#define BX_ALIGN_DECL_16(_decl) BX_ALIGN_DECL(16, _decl)
|
||||
#define BX_ALIGN_DECL_256(_decl) BX_ALIGN_DECL(256, _decl)
|
||||
|
||||
Reference in New Issue
Block a user