mirror of https://github.com/OpenTTD/OpenTTD
(svn r8847) -Fix
There is not much point in hiding a normal 64bit multiplication in a function, so do not do itrelease/0.6
parent
8b94d4df22
commit
2e4844abad
|
@ -613,9 +613,8 @@ static void PlayersGenStatistics(void)
|
||||||
|
|
||||||
static void AddSingleInflation(int32 *value, uint16 *frac, int32 amt)
|
static void AddSingleInflation(int32 *value, uint16 *frac, int32 amt)
|
||||||
{
|
{
|
||||||
int64 tmp;
|
int64 tmp = (int64)*value * amt;
|
||||||
int32 low;
|
int32 low;
|
||||||
tmp = BIGMULS(*value, amt);
|
|
||||||
*frac = (uint16)(low = (uint16)tmp + *frac);
|
*frac = (uint16)(low = (uint16)tmp + *frac);
|
||||||
*value += (int32)(tmp >> 16) + (low >> 16);
|
*value += (int32)(tmp >> 16) + (low >> 16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,6 @@ static inline uint32 BIGMULUS(uint32 a, uint32 b, int shift)
|
||||||
return (uint32)((uint64)a * (uint64)b >> shift);
|
return (uint32)((uint64)a * (uint64)b >> shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int64 BIGMULS(int32 a, int32 b)
|
|
||||||
{
|
|
||||||
return (int64)a * (int64)b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OPT: optimized into an unsigned comparison */
|
/* OPT: optimized into an unsigned comparison */
|
||||||
//#define IS_INSIDE_1D(x, base, size) ((x) >= (base) && (x) < (base) + (size))
|
//#define IS_INSIDE_1D(x, base, size) ((x) >= (base) && (x) < (base) + (size))
|
||||||
|
|
Loading…
Reference in New Issue