mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-16 04:36:59 +00:00
Latte: Implement better index caching (#1443)
This commit is contained in:
parent
1923b7a7c4
commit
8dd809d725
16 changed files with 526 additions and 191 deletions
|
|
@ -274,6 +274,25 @@ inline uint64 _udiv128(uint64 highDividend, uint64 lowDividend, uint64 divisor,
|
|||
#define NOEXPORT __attribute__ ((visibility ("hidden")))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FORCE_INLINE __forceinline
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCE_INLINE
|
||||
#endif
|
||||
|
||||
FORCE_INLINE inline int BSF(uint32 v) // returns index of first bit set, counting from LSB. If v is 0 then result is undefined
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
return _tzcnt_u32(v); // TZCNT requires BMI1. But if not supported it will execute as BSF
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
return __builtin_ctz(v);
|
||||
#else
|
||||
return std::countr_zero(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
// On aarch64 we handle some of the x86 intrinsics by implementing them as wrappers
|
||||
#if defined(__aarch64__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue