mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
To: zippel@linux-m68k.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 1/4] introduce explicit signed/unsigned 64bit divide
Date: Thu, 13 Mar 2008 11:13:31 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0803131110520.9727@vixen.sonytel.be> (raw)
In-Reply-To: <20080313004902.808083566@linux-m68k.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1961 bytes --]

On Thu, 13 Mar 2008, zippel@linux-m68k.org wrote:
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6/include/linux/math64.h	2008-03-12 21:21:26.000000000 +0100
> @@ -0,0 +1,72 @@
> +#ifndef _LINUX_MATH64_H
> +#define _LINUX_MATH64_H
> +
> +#include <linux/types.h>
> +#include <asm/div64.h>
> +
> +#if BITS_PER_LONG == 64
> +
> +/**
> + * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
> + *
> + * This is commonly provided by 32bit archs to provide an optimized 64bit
> + * divide.
> + */
> +static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
> +{
> +	*remainder = dividend % divisor;
> +	return dividend / divisor;
> +}
> +
> +/**
> + * div_s64_rem - signed 64bit divide with 32bit divisor with remainder
> + */
> +static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
                 ^       ^       ^             ^            ^
		 s64 div_s64_rem s64           s32          s32
> +{
> +	*remainder = dividend % divisor;
> +	return dividend / divisor;
> +}
> +
> +#elif BITS_PER_LONG == 32
> +
> +#ifndef div_u64_rem
> +static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
> +{
> +	*remainder = do_div(dividend, divisor);
> +	return dividend;
> +}
> +#endif
> +
> +#ifndef div_s64_rem
> +extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
> +#endif

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

  reply	other threads:[~2008-03-13 10:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  0:22 [PATCH 0/4] [RFC] cleanup 64bit divide API zippel
2008-03-13  0:22 ` [PATCH 1/4] introduce explicit signed/unsigned 64bit divide zippel
2008-03-13 10:13   ` Geert Uytterhoeven [this message]
2008-03-13 14:59     ` Roman Zippel
2008-03-13 20:34       ` Andrew Morton
2008-03-14 17:45         ` Roman Zippel
2008-03-13  0:22 ` [PATCH 2/4] convert a few do_div user zippel
2008-03-18 20:10   ` Jörg-Volker Peetz
2008-03-13  0:22 ` [PATCH 3/4] rename div64_64 to div64_u64 zippel
2008-03-13  0:22 ` [PATCH 4/4] remove div_long_long_rem zippel
2008-03-13  0:22 ` [PATCH 5/4] 2.6.25-rc5-mm1 specifc div64_u64 fixes zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0803131110520.9727@vixen.sonytel.be \
    --to=geert.uytterhoeven@sonycom.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®