All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Troy Benjegerdes <hozer@drgw.net>
Cc: wli@holomorphy.com, torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bring sanity to div64.h and do_div usage
Date: Fri, 08 Feb 2002 20:04:29 +0100	[thread overview]
Message-ID: <3C64213D.6070808@linux-m68k.org> (raw)
In-Reply-To: <20020207234555.N17426@altus.drgw.net>

Hi,

Troy Benjegerdes wrote:

> +#else /* USE_SLOW_64BIT_DIVIDES */
> +		/*
> +		 * Nasty ugly generic C 64 bit divide on 32 bit machine
> +		 * No one seems to want to take credit for this
> +		 */
> +		unsigned long low, low2, high;
> +		low  = (t) & 0xffffffff;
> +		high = (t) >> 32;
> +		res   = high % base;
> +		high  = high / base;
> +		low2  = low >> 16;
> +		low2 += res << 16;
> +		res   = low2 % base;
> +		low2  = low2 / base;
> +		low   = low & 0xffff;
> +		low  += res << 16;
> +		res   = low  % base;
> +		low   = low  / base;
> +		t = low  + ((long long)low2 << 16) +
> +			((long long) high << 32);


IMO this is large enough to put under lib/..., the rest could also be 
put into asm-generic, from where the archs could include it, this would 
avoid this:

 > +#ifdef __USE_ASM
 > +/* yeah, this is a mess, and leaves out m68k.... */
 > +# if defined(CONFIG_X86) || define(CONFIG_ARCH_S390) || 
defined(CONFIG_MIPS)
 > +#  define __USE_ASM__
 > +# endif
 > +#endif

bye, Roman


      parent reply	other threads:[~2002-02-08 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-08  5:45 [PATCH] bring sanity to div64.h and do_div usage Troy Benjegerdes
2002-02-08 12:15 ` Anton Altaparmakov
2002-02-08 17:57   ` Troy Benjegerdes
2002-02-08 18:49     ` Maciej W. Rozycki
2002-02-08 19:34   ` Anton Altaparmakov
2002-02-08 21:16     ` Troy Benjegerdes
2002-02-15 18:47     ` Updated div64.h cleanup Troy Benjegerdes
2002-02-22 14:59     ` [PATCH] bring sanity to div64.h and do_div usage Jes Sorensen
2002-02-22 15:17       ` Jeff Garzik
2002-02-22 15:20         ` Jes Sorensen
2002-02-22 15:26           ` Jeff Garzik
2002-02-22 15:34             ` Jes Sorensen
2002-02-22 16:05               ` Jeff Garzik
2002-02-22 15:55             ` Andreas Schwab
2002-02-22 16:00               ` Jeff Garzik
2002-02-22 16:08           ` Nicolas Pitre
2002-02-08 12:29 ` Anton Altaparmakov
2002-02-08 19:04 ` Roman Zippel [this message]

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=3C64213D.6070808@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=hozer@drgw.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=wli@holomorphy.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.