diff options
author | darkvater <darkvater@openttd.org> | 2004-09-13 20:38:36 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-09-13 20:38:36 +0000 |
commit | fc9a450e758067385129eddf3001efee9e562518 (patch) | |
tree | fbd94462b721e747cd83ba19d0dbf192ffd81440 /macros.h | |
parent | add49120dde81d212df460679bec15cbdd04a6a3 (diff) | |
download | openttd-fc9a450e758067385129eddf3001efee9e562518.tar.xz |
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
-Fix: Graphs now accomodate 64bit numbers (so the company value graph doesn't plummet into -... if value is too big)
-Strgen: added CURRCOMPACT64 for this, and 64bit versions of several macros.
Diffstat (limited to 'macros.h')
-rw-r--r-- | macros.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -13,6 +13,7 @@ static INLINE int min(int a, int b) { if (a <= b) return a; return b; } static INLINE int max(int a, int b) { if (a >= b) return a; return b; } +static INLINE int64 max64(int64 a, int64 b) { if (a >= b) return a; return b; } static INLINE uint minu(uint a, uint b) { if (a <= b) return a; return b; } static INLINE uint maxu(uint a, uint b) { if (a >= b) return a; return b; } @@ -49,6 +50,10 @@ static INLINE int32 BIGMULSS(int32 a, int32 b, int shift) { return (int32)(((int64)(a) * (int64)(b)) >> (shift)); } +static INLINE int64 BIGMULSS64(int64 a, int64 b, int shift) { + return ((a) * (b)) >> (shift); +} + static INLINE uint32 BIGMULUS(uint32 a, uint32 b, int shift) { return (uint32)(((uint64)(a) * (uint64)(b)) >> (shift)); } @@ -194,6 +199,7 @@ static INLINE int intxchg_(int *a, int b) { int t = *a; *a = b; return t; } #define intswap(a,b) ((b) = intxchg_(&(a), (b))) static INLINE int myabs(int a) { if (a<0) a = -a; return a; } +static INLINE int64 myabs64(int64 a) { if (a<0) a = -a; return a; } static INLINE void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; } static INLINE void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; } |