All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: 64-bit modulus operation in a 32-bit kernel
Date: Tue, 24 Apr 2012 21:15:19 +0200	[thread overview]
Message-ID: <m2lillj60o.fsf@igel.home> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1204241347490.1511-100000@iolanthe.rowland.org> (Alan Stern's message of "Tue, 24 Apr 2012 13:50:01 -0400 (EDT)")

Alan Stern <stern@rowland.harvard.edu> writes:

> I need to compute the remainder when a 64-bit quantity is divided by a 
> small value (126 in this case).  The % operator doesn't work in an 
> x86/32 kernel.  What's the Right Way to do it?

#include <asm/div64.h>

do_div(n,base) returns the remainder.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

      parent reply	other threads:[~2012-04-24 19:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 17:50 64-bit modulus operation in a 32-bit kernel Alan Stern
2012-04-24 18:20 ` Takashi Iwai
2012-04-24 18:57   ` Alan Stern
2012-04-24 19:15 ` Andreas Schwab [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=m2lillj60o.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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.