mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
PPUInterpreter: Fix undefined behavior of left rotate functions (#2469)
* PPUInterpreter: Fix undefined behavior of rol8 and rol16 with inline assembly * PPUInterpreter: Fix undefined behavior of rol32 and rol64 * PPUInterpreter: Change left rotate functions to inline functions and move to types.h
This commit is contained in:
parent
ef5225b776
commit
67ac8bf070
2 changed files with 36 additions and 5 deletions
|
@ -5,11 +5,6 @@
|
|||
|
||||
#include <cmath>
|
||||
|
||||
// TODO: fix rol8 and rol16 for __GNUG__ (probably with __asm__)
|
||||
inline u8 rol8(const u8 x, const u8 n) { return x << n | x >> (8 - n); }
|
||||
inline u16 rol16(const u16 x, const u16 n) { return x << n | x >> (16 - n); }
|
||||
inline u32 rol32(const u32 x, const u32 n) { return x << n | x >> (32 - n); }
|
||||
inline u64 rol64(const u64 x, const u64 n) { return x << n | x >> (64 - n); }
|
||||
inline u64 dup32(const u32 x) { return x | static_cast<u64>(x) << 32; }
|
||||
|
||||
#if defined(__GNUG__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue