mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
6f6d6a1a6a
Rename div64_64 to div64_u64 to make it consistent with the other divide functions, so it clearly includes the type of the divide. Move its definition to math64.h as currently no architecture overrides the generic implementation. They can still override it of course, but the duplicated declarations are avoided. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: Avi Kivity <avi@qumranet.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: David Howells <dhowells@redhat.com> Cc: Jeff Dike <jdike@addtoit.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Patrick McHardy <kaber@trash.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
28 lines
647 B
C
28 lines
647 B
C
#ifndef _M68K_DIV64_H
|
|
#define _M68K_DIV64_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
/* n = n / base; return rem; */
|
|
|
|
#define do_div(n, base) ({ \
|
|
union { \
|
|
unsigned long n32[2]; \
|
|
unsigned long long n64; \
|
|
} __n; \
|
|
unsigned long __rem, __upper; \
|
|
\
|
|
__n.n64 = (n); \
|
|
if ((__upper = __n.n32[0])) { \
|
|
asm ("divul.l %2,%1:%0" \
|
|
: "=d" (__n.n32[0]), "=d" (__upper) \
|
|
: "d" (base), "0" (__n.n32[0])); \
|
|
} \
|
|
asm ("divu.l %2,%1:%0" \
|
|
: "=d" (__n.n32[1]), "=d" (__rem) \
|
|
: "d" (base), "1" (__upper), "0" (__n.n32[1])); \
|
|
(n) = __n.n64; \
|
|
__rem; \
|
|
})
|
|
|
|
#endif /* _M68K_DIV64_H */
|