mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
unrolled modulo in {div|divu}_64x32_rem() and {mod|modu}_64x32() since it is apparently faster - this also gets rid of a duplicated div operation in {div|divu}_64x32_rem() / div*_64x32_rem() now call div*_64x32() (nw)
This commit is contained in:
parent
46c6b98571
commit
edd2d136a0
@ -155,8 +155,9 @@ INLINE UINT32 divu_64x32(UINT64 a, UINT32 b)
|
||||
#ifndef div_64x32_rem
|
||||
INLINE INT32 div_64x32_rem(INT64 a, INT32 b, INT32 *remainder)
|
||||
{
|
||||
*remainder = a % (INT64)b;
|
||||
return a / (INT64)b;
|
||||
INT32 res = div_64x32(a, b);
|
||||
*remainder = a - ((INT64)b * res);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -170,8 +171,9 @@ INLINE INT32 div_64x32_rem(INT64 a, INT32 b, INT32 *remainder)
|
||||
#ifndef divu_64x32_rem
|
||||
INLINE UINT32 divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder)
|
||||
{
|
||||
*remainder = a % (UINT64)b;
|
||||
return a / (UINT64)b;
|
||||
UINT32 res = divu_64x32(a, b);
|
||||
*remainder = a - ((UINT64)b * res);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -212,7 +214,7 @@ INLINE UINT32 divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
|
||||
#ifndef mod_64x32
|
||||
INLINE INT32 mod_64x32(INT64 a, INT32 b)
|
||||
{
|
||||
return a % (INT64)b;
|
||||
return a - (b * div_64x32(a, b));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -225,7 +227,7 @@ INLINE INT32 mod_64x32(INT64 a, INT32 b)
|
||||
#ifndef modu_64x32
|
||||
INLINE UINT32 modu_64x32(UINT64 a, UINT32 b)
|
||||
{
|
||||
return a % (UINT64)b;
|
||||
return a - (b * divu_64x32(a, b));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user