mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Minor fixes to generic do_div
Date: Thu, 19 Oct 2006 21:59:54 -0700	[thread overview]
Message-ID: <20061019215954.1be82a57.akpm@osdl.org> (raw)
In-Reply-To: <20061020033359.GR2602@parisc-linux.org>

On Thu, 19 Oct 2006 21:34:00 -0600
Matthew Wilcox <matthew@wil.cx> wrote:

> +/* The unnecessary pointer compare is there
> + * to check for type safety (n must be 64bit)
> + */
> +# define do_div(n,base) ({				\
> +	uint32_t __base = (base);			\
> +	uint32_t __rem;					\
> +	(void)(((typeof((n)) *)0) == ((uint64_t *)0));	\
> +	__rem = ((uint64_t)(n)) % __base;		\
> +	(n) = ((uint64_t)(n)) / __base;			\
> +	__rem;						\
>   })

Can we use typecheck(), from include/linux/kernel.h?

  reply	other threads:[~2006-10-20  4:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20  3:34 Matthew Wilcox
2006-10-20  4:59 ` Andrew Morton [this message]
2006-10-20  5:36   ` Matthew Wilcox
2006-10-20  5:49     ` Andrew Morton
2006-10-23  7:49 ` Paul Mackerras

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=20061019215954.1be82a57.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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®