summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-09-13 20:38:36 +0000
committerdarkvater <darkvater@openttd.org>2004-09-13 20:38:36 +0000
commitfc9a450e758067385129eddf3001efee9e562518 (patch)
treefbd94462b721e747cd83ba19d0dbf192ffd81440 /macros.h
parentadd49120dde81d212df460679bec15cbdd04a6a3 (diff)
downloadopenttd-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.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 5e0ff540c..40c923f7e 100644
--- a/macros.h
+++ b/macros.h
@@ -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; }