mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 21:30:09 +00:00
ab8f16961e
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
59 lines
904 B
C
59 lines
904 B
C
#ifndef B3_SWAP_UTILS_H
|
|
#define B3_SWAP_UTILS_H
|
|
|
|
inline void b3Swap16(unsigned char *ptr)
|
|
{
|
|
unsigned char val;
|
|
|
|
// Swap 1st and 2nd bytes
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 1);
|
|
*(ptr + 1) = val;
|
|
}
|
|
|
|
inline void b3Swap32(unsigned char *ptr)
|
|
{
|
|
unsigned char val;
|
|
|
|
// Swap 1st and 4th bytes
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 3);
|
|
*(ptr + 3) = val;
|
|
|
|
//Swap 2nd and 3rd bytes
|
|
ptr += 1;
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 1);
|
|
*(ptr + 1) = val;
|
|
}
|
|
|
|
inline void b3Swap64(unsigned char *ptr)
|
|
{
|
|
unsigned char val;
|
|
|
|
// Swap 1st and 8th bytes
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 7);
|
|
*(ptr + 7) = val;
|
|
|
|
// Swap 2nd and 7th bytes
|
|
ptr += 1;
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 5);
|
|
*(ptr + 5) = val;
|
|
|
|
// Swap 3rd and 6th bytes
|
|
ptr += 1;
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 3);
|
|
*(ptr + 3) = val;
|
|
|
|
// Swap 4th and 5th bytes
|
|
ptr += 1;
|
|
val = *(ptr);
|
|
*(ptr) = *(ptr + 1);
|
|
*(ptr + 1) = val;
|
|
}
|
|
|
|
#endif //B3_SWAP_UTILS_H
|