mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-26 10:17:59 +00:00
Fix asm
This commit is contained in:
parent
87375f4c14
commit
b9350e3876
1 changed files with 9 additions and 6 deletions
|
@ -67,7 +67,7 @@ static const float kFloatConversion[256] = {
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static inline uint32 CountBitsInMask(uint8 n) {
|
static inline uint32 CountBitsInMask(uint8 n) {
|
||||||
|
|
||||||
#if defined(_WIN64) || defined(NO_INLINE_ASSEMBLY)
|
#if defined(_WIN64) || defined(__x86_64__) || defined(NO_INLINE_ASSEMBLY)
|
||||||
if(!n) return 0; // no bits set
|
if(!n) return 0; // no bits set
|
||||||
if(!(n & (n-1))) return 1; // power of two
|
if(!(n & (n-1))) return 1; // power of two
|
||||||
|
|
||||||
|
@ -85,14 +85,17 @@ static inline uint32 CountBitsInMask(uint8 n) {
|
||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
__asm__("mov %%eax, 8;"
|
uint32 ans;
|
||||||
"movzbl %0, %%ecx;"
|
__asm__("movl $8, %%eax;"
|
||||||
|
"movzbl %b1, %%ecx;"
|
||||||
"bsf %%ecx, %%ecx;"
|
"bsf %%ecx, %%ecx;"
|
||||||
"sub %%eax, %%ecx;"
|
"subl %%ecx, %%eax;"
|
||||||
: // No output registers
|
"movl %%eax, %0;"
|
||||||
|
: "=Q"(ans)
|
||||||
: "r"(n)
|
: "r"(n)
|
||||||
: "%eax", "%ecx"
|
: "%eax", "%ecx"
|
||||||
);
|
);
|
||||||
|
return ans;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -105,7 +108,7 @@ static inline void clamp(ty &x, const ty &min, const ty &max) {
|
||||||
// absolute distance. It turns out the compiler does a much
|
// absolute distance. It turns out the compiler does a much
|
||||||
// better job of optimizing this than we can, since we can't
|
// better job of optimizing this than we can, since we can't
|
||||||
// translate the values to/from registers
|
// translate the values to/from registers
|
||||||
static uint8 sad(uint8 a, uint8 b) {
|
static uint sad(uint8 a, uint8 b) {
|
||||||
#if 0
|
#if 0
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue