Updated ozz-animation to version 0.14.3 (commit 92c392b667844)
This commit is contained in:
+19
-23
@@ -66,12 +66,11 @@ template <typename _Ty, size_t _size = sizeof(_Ty)>
|
||||
struct EndianSwapper;
|
||||
|
||||
// Internal macro used to swap two bytes.
|
||||
#define OZZ_BYTE_SWAP(_a, _b) \
|
||||
do { \
|
||||
const ozz::byte temp = (_a); \
|
||||
(_a) = (_b); \
|
||||
(_b) = temp; \
|
||||
} while (0)
|
||||
OZZ_INLINE void _in_place_byte_swap(byte& _a, byte& _b) {
|
||||
_a = _a ^ _b;
|
||||
_b = _a ^ _b;
|
||||
_a = _a ^ _b;
|
||||
}
|
||||
|
||||
// EndianSwapper specialization for 1 byte types.
|
||||
template <typename _Ty>
|
||||
@@ -86,12 +85,12 @@ struct EndianSwapper<_Ty, 2> {
|
||||
OZZ_INLINE static void Swap(_Ty* _ty, size_t _count) {
|
||||
byte* alias = reinterpret_cast<byte*>(_ty);
|
||||
for (size_t i = 0; i < _count * 2; i += 2) {
|
||||
OZZ_BYTE_SWAP(alias[i + 0], alias[i + 1]);
|
||||
_in_place_byte_swap(alias[i + 0], alias[i + 1]);
|
||||
}
|
||||
}
|
||||
OZZ_INLINE static _Ty Swap(_Ty _ty) { // Pass by copy to swap _ty in-place.
|
||||
byte* alias = reinterpret_cast<byte*>(&_ty);
|
||||
OZZ_BYTE_SWAP(alias[0], alias[1]);
|
||||
_in_place_byte_swap(alias[0], alias[1]);
|
||||
return _ty;
|
||||
}
|
||||
};
|
||||
@@ -102,14 +101,14 @@ struct EndianSwapper<_Ty, 4> {
|
||||
OZZ_INLINE static void Swap(_Ty* _ty, size_t _count) {
|
||||
byte* alias = reinterpret_cast<byte*>(_ty);
|
||||
for (size_t i = 0; i < _count * 4; i += 4) {
|
||||
OZZ_BYTE_SWAP(alias[i + 0], alias[i + 3]);
|
||||
OZZ_BYTE_SWAP(alias[i + 1], alias[i + 2]);
|
||||
_in_place_byte_swap(alias[i + 0], alias[i + 3]);
|
||||
_in_place_byte_swap(alias[i + 1], alias[i + 2]);
|
||||
}
|
||||
}
|
||||
OZZ_INLINE static _Ty Swap(_Ty _ty) { // Pass by copy to swap _ty in-place.
|
||||
byte* alias = reinterpret_cast<byte*>(&_ty);
|
||||
OZZ_BYTE_SWAP(alias[0], alias[3]);
|
||||
OZZ_BYTE_SWAP(alias[1], alias[2]);
|
||||
_in_place_byte_swap(alias[0], alias[3]);
|
||||
_in_place_byte_swap(alias[1], alias[2]);
|
||||
return _ty;
|
||||
}
|
||||
};
|
||||
@@ -120,25 +119,22 @@ struct EndianSwapper<_Ty, 8> {
|
||||
OZZ_INLINE static void Swap(_Ty* _ty, size_t _count) {
|
||||
byte* alias = reinterpret_cast<byte*>(_ty);
|
||||
for (size_t i = 0; i < _count * 8; i += 8) {
|
||||
OZZ_BYTE_SWAP(alias[i + 0], alias[i + 7]);
|
||||
OZZ_BYTE_SWAP(alias[i + 1], alias[i + 6]);
|
||||
OZZ_BYTE_SWAP(alias[i + 2], alias[i + 5]);
|
||||
OZZ_BYTE_SWAP(alias[i + 3], alias[i + 4]);
|
||||
_in_place_byte_swap(alias[i + 0], alias[i + 7]);
|
||||
_in_place_byte_swap(alias[i + 1], alias[i + 6]);
|
||||
_in_place_byte_swap(alias[i + 2], alias[i + 5]);
|
||||
_in_place_byte_swap(alias[i + 3], alias[i + 4]);
|
||||
}
|
||||
}
|
||||
OZZ_INLINE static _Ty Swap(_Ty _ty) { // Pass by copy to swap _ty in-place.
|
||||
byte* alias = reinterpret_cast<byte*>(&_ty);
|
||||
OZZ_BYTE_SWAP(alias[0], alias[7]);
|
||||
OZZ_BYTE_SWAP(alias[1], alias[6]);
|
||||
OZZ_BYTE_SWAP(alias[2], alias[5]);
|
||||
OZZ_BYTE_SWAP(alias[3], alias[4]);
|
||||
_in_place_byte_swap(alias[0], alias[7]);
|
||||
_in_place_byte_swap(alias[1], alias[6]);
|
||||
_in_place_byte_swap(alias[2], alias[5]);
|
||||
_in_place_byte_swap(alias[3], alias[4]);
|
||||
return _ty;
|
||||
}
|
||||
};
|
||||
|
||||
// OZZ_BYTE_SWAP is not useful anymore.
|
||||
#undef OZZ_BYTE_SWAP
|
||||
|
||||
// Helper function that swaps _count elements of the array _ty in place.
|
||||
template <typename _Ty>
|
||||
OZZ_INLINE void EndianSwap(_Ty* _ty, size_t _count) {
|
||||
|
||||
Reference in New Issue
Block a user