Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3927f2e8 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

[NET]: div64_64 consolidate (rev3)



Here is the current version of the 64 bit divide common code.

Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d729f72
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
#define __ASM_ARM_DIV64

#include <asm/system.h>
#include <linux/types.h>

/*
 * The semantics of do_div() are:
@@ -223,4 +224,6 @@

#endif

extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);

#endif
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@
	__rem;							\
 })

static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
{
	return dividend / divisor;
}

#elif BITS_PER_LONG == 32

extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
@@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
	__rem;						\
 })

extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);

#else /* BITS_PER_LONG == ?? */

# error do_div() does not yet support the C64
+4 −0
Original line number Diff line number Diff line
#ifndef __I386_DIV64
#define __I386_DIV64

#include <linux/types.h>

/*
 * do_div() is NOT a C function. It wants to return
 * two values (the quotient and the remainder), but
@@ -45,4 +47,6 @@ div_ll_X_l_rem(long long divs, long div, long *rem)
	return dum2;

}

extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
#endif
+3 −0
Original line number Diff line number Diff line
#ifndef _M68K_DIV64_H
#define _M68K_DIV64_H

#include <linux/types.h>

/* n = n / base; return rem; */

#define do_div(n, base) ({					\
@@ -23,4 +25,5 @@
	__rem;							\
})

extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
#endif /* _M68K_DIV64_H */
+10 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2000, 2004  Maciej W. Rozycki
 * Copyright (C) 2003 Ralf Baechle
 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,8 @@
#ifndef _ASM_DIV64_H
#define _ASM_DIV64_H

#include <linux/types.h>

#if (_MIPS_SZLONG == 32)

#include <asm/compiler.h>
@@ -78,6 +80,8 @@
	__quot = __quot << 32 | __low; \
	(n) = __quot; \
	__mod; })

extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
#endif /* (_MIPS_SZLONG == 32) */

#if (_MIPS_SZLONG == 64)
@@ -101,6 +105,11 @@
	(n) = __quot; \
	__mod; })

static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
{
	return dividend / divisor;
}

#endif /* (_MIPS_SZLONG == 64) */

#endif /* _ASM_DIV64_H */
Loading