changeset 7926:e8ce9f6469d1 draft

(svn r11479) -Codechange: Move the BIGMUL functions to the file of their usage -Codechange: Rename the BIGMUL functions to the fitting naming style
author skidd13 <skidd13@openttd.org>
date Mon, 19 Nov 2007 20:18:27 +0000
parents 6a2f7c2c4ac6
children 09dbacdca8de
files src/economy.cpp src/macros.h
diffstat 2 files changed, 34 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -43,6 +43,38 @@
 #include "player_face.h"
 #include "group.h"
 
+/**
+ * Multiply two integer values and shift the results to right.
+ *
+ * This function multiplies two integer values. The result is
+ * shifted by the amount of shift to right.
+ *
+ * @param a The first integer
+ * @param b The second integer
+ * @param shift The amount to shift the value to right.
+ * @return The shifted result
+ */
+static inline int32 BigMulS(const int32 a, const int32 b, const uint8 shift)
+{
+	return (int32)((int64)a * (int64)b >> shift);
+}
+
+/**
+ * Multiply two unsigned integers and shift the results to right.
+ *
+ * This function multiplies two unsigned integers. The result is
+ * shifted by the amount of shift to right.
+ *
+ * @param a The first unsigned integer
+ * @param b The second unsigned integer
+ * @param shift The amount to shift the value to right.
+ * @return The shifted result
+ */
+static inline uint32 BigMulSU(const uint32 a, const uint32 b, const uint8 shift)
+{
+	return (uint32)((uint64)a * (uint64)b >> shift);
+}
+
 /* Score info */
 const ScoreInfo _score_info[] = {
 	{ SCORE_VEHICLES,        120, 100 },
@@ -706,7 +738,7 @@
 		_current_player = p->index;
 		SET_EXPENSES_TYPE(EXPENSES_LOAN_INT);
 
-		SubtractMoneyFromPlayer(CommandCost((Money)BIGMULUS(p->current_loan, interest, 16)));
+		SubtractMoneyFromPlayer(CommandCost((Money)BigMulSU(p->current_loan, interest, 16)));
 
 		SET_EXPENSES_TYPE(EXPENSES_OTHER);
 		SubtractMoneyFromPlayer(_price.station_value >> 2);
@@ -1195,7 +1227,7 @@
 
 	if (time_factor < MIN_TIME_FACTOR) time_factor = MIN_TIME_FACTOR;
 
-	return BIGMULSS(dist * time_factor * num_pieces, _cargo_payment_rates[cargo_type], 21);
+	return BigMulS(dist * time_factor * num_pieces, _cargo_payment_rates[cargo_type], 21);
 }
 
 static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pieces)
--- a/src/macros.h
+++ b/src/macros.h
@@ -221,38 +221,6 @@
 }
 
 /**
- * Multiply two integer values and shift the results to right.
- *
- * This function multiplies two integer values. The result is
- * shifted by the amount of shift to right.
- *
- * @param a The first integer
- * @param b The second integer
- * @param shift The amount to shift the value to right.
- * @return The shifted result
- */
-static inline int32 BIGMULSS(const int32 a, const int32 b, const uint8 shift)
-{
-	return (int32)((int64)a * (int64)b >> shift);
-}
-
-/**
- * Multiply two unsigned integers and shift the results to right.
- *
- * This function multiplies two unsigned integers. The result is
- * shifted by the amount of shift to right.
- *
- * @param a The first unsigned integer
- * @param b The second unsigned integer
- * @param shift The amount to shift the value to right.
- * @return The shifted result
- */
-static inline uint32 BIGMULUS(const uint32 a, const uint32 b, const uint8 shift)
-{
-	return (uint32)((uint64)a * (uint64)b >> shift);
-}
-
-/**
  * Checks if a bit in a value is set.
  *
  * This function checks if a bit inside a value is set or not.