projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.denx.de/u-boot-samsung
[platform/kernel/u-boot.git]
/
include
/
div64.h
diff --git
a/include/div64.h
b/include/div64.h
index
2e0ba83
..
d833144
100644
(file)
--- a/
include/div64.h
+++ b/
include/div64.h
@@
-8,9
+8,9
@@
*
* uint32_t do_div(uint64_t *n, uint32_t base)
* {
*
* uint32_t do_div(uint64_t *n, uint32_t base)
* {
- * uint32_t remainder = *n % base;
- * *n = *n / base;
- * return remainder;
+ * uint32_t remainder = *n % base;
+ * *n = *n / base;
+ * return remainder;
* }
*
* NOTE: macro parameter n is evaluated multiple times,
* }
*
* NOTE: macro parameter n is evaluated multiple times,
@@
-31,9
+31,19
@@
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
if (((n) >> 32) == 0) { \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n) / __base; \
if (((n) >> 32) == 0) { \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n) / __base; \
- } else \
+ } else \
__rem = __div64_32(&(n), __base); \
__rem; \
})
__rem = __div64_32(&(n), __base); \
__rem; \
})
+/* Wrapper for do_div(). Doesn't modify dividend and returns
+ * the result, not reminder.
+ */
+static inline uint64_t lldiv(uint64_t dividend, uint32_t divisor)
+{
+ uint64_t __res = dividend;
+ do_div(__res, divisor);
+ return(__res);
+}
+
#endif /* _ASM_GENERIC_DIV64_H */
#endif /* _ASM_GENERIC_DIV64_H */