summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorSergei Poselenov <sposelenov@emcraft.com>2008-08-14 14:08:28 +0200
committerWolfgang Denk <wd@denx.de>2008-09-09 02:14:41 +0200
commit4265c35fbcb248e58179007621d61d32d0b3b82a (patch)
tree4a97e0570b7b11a9ae895bf9fd0be14d51461b0f /board
parent1055171ed05b7c4885737463d52b8d6c013bcb5d (diff)
downloadu-boot-imx-4265c35fbcb248e58179007621d61d32d0b3b82a.zip
u-boot-imx-4265c35fbcb248e58179007621d61d32d0b3b82a.tar.gz
u-boot-imx-4265c35fbcb248e58179007621d61d32d0b3b82a.tar.bz2
ARM: Use do_div() instead of division for "long long".
Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com> Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board')
-rw-r--r--board/integratorcp/integratorcp.c7
-rw-r--r--board/trab/tsc2000.c10
2 files changed, 12 insertions, 5 deletions
diff --git a/board/integratorcp/integratorcp.c b/board/integratorcp/integratorcp.c
index d6d6e13..220513f 100644
--- a/board/integratorcp/integratorcp.c
+++ b/board/integratorcp/integratorcp.c
@@ -34,6 +34,7 @@
*/
#include <common.h>
+#include <div64.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -244,7 +245,11 @@ ulong get_timer_masked (void)
total_count += lastdec - now;
}
lastdec = now;
- timestamp = (ulong)(total_count/div_timer);
+
+ /* Reuse "now" */
+ now = total_count;
+ do_div(now, div_timer);
+ timestamp = now;
return timestamp;
}
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index 382a85b..f13a5a9 100644
--- a/board/trab/tsc2000.c
+++ b/board/trab/tsc2000.c
@@ -27,6 +27,7 @@
#include <common.h>
#include <s3c2400.h>
+#include <div64.h>
#include "tsc2000.h"
#include "Pt1000_temp_data.h"
@@ -332,6 +333,7 @@ void tsc2000_reg_init (void)
int tsc2000_interpolate(long value, long data[][2], long *result)
{
int i;
+ unsigned long long val;
/* the data is sorted and the first element is upper
* limit so we can easily check for out-of-band values
@@ -347,10 +349,10 @@ int tsc2000_interpolate(long value, long data[][2], long *result)
result in 'long long'.
*/
- *result = data[i-1][1] +
- ((unsigned long long)(data[i][1] - data[i-1][1])
- * (unsigned long long)(value - data[i-1][0]))
- / (data[i][0] - data[i-1][0]);
+ val = ((unsigned long long)(data[i][1] - data[i-1][1])
+ * (unsigned long long)(value - data[i-1][0]));
+ do_div(val, (data[i][0] - data[i-1][0]));
+ *result = data[i-1][1] + val;
return 0;
}