mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-04 09:22:38 +00:00
Merge branch 'vertex-loader-cleanup'
This commit is contained in:
commit
8d5299c20b
18 changed files with 770 additions and 1732 deletions
|
@ -172,6 +172,41 @@ inline u64 swap64(u64 data) {return ((u64)swap32(data) << 32) | swap32(data >> 3
|
|||
inline u16 swap16(const u8* _pData) {return swap16(*(const u16*)_pData);}
|
||||
inline u32 swap32(const u8* _pData) {return swap32(*(const u32*)_pData);}
|
||||
inline u64 swap64(const u8* _pData) {return swap64(*(const u64*)_pData);}
|
||||
|
||||
template <int count>
|
||||
void swap(u8*);
|
||||
|
||||
template <>
|
||||
inline void swap<1>(u8* data)
|
||||
{}
|
||||
|
||||
template <>
|
||||
inline void swap<2>(u8* data)
|
||||
{
|
||||
*reinterpret_cast<u16*>(data) = swap16(data);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void swap<4>(u8* data)
|
||||
{
|
||||
*reinterpret_cast<u32*>(data) = swap32(data);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void swap<8>(u8* data)
|
||||
{
|
||||
*reinterpret_cast<u64*>(data) = swap64(data);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T FromBigEndian(T data)
|
||||
{
|
||||
//static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types");
|
||||
|
||||
swap<sizeof(data)>(reinterpret_cast<u8*>(&data));
|
||||
return data;
|
||||
}
|
||||
|
||||
} // Namespace Common
|
||||
|
||||
#endif // _COMMONFUNCS_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue