linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: michael@ellerman.id.au
Cc: linuxppc-dev list <linuxppc-dev@ozlabs.org>,
	Kumar Gala <kumar.gala@freescale.com>,
	Jin Zhengxiong <Jason.Jin@freescale.com>
Subject: Re: [PATCH 1/3] MSI driver for Freescale 83xx/85xx/86xx cpu
Date: Wed, 23 Apr 2008 18:05:47 +0200	[thread overview]
Message-ID: <8c9045cf69926c5ea881b780054e1c17@kernel.crashing.org> (raw)
In-Reply-To: <1208929545.9212.12.camel@concordia.ozlabs.ibm.com>

>>> data = ((hwirq / 32) << 5) | ((hwirq % 32) & 0x1F)
>>>
>>> Which doesn't seem to actually do anything?
>>
>> It's not a no-op, because hwirq is signed.  It probably should be
>> unsigned, like most things.
>
> You'll have to draw me a picture.

In C, signed division is round-towards-zero, while unsigned division
is round-towards-negative-infinity.  Suppose hwirq is -1, then
hwirq/32 is 0 and hwirq%32 is -1, so that the full expression above
will be 0x1f, not -1.  There is no such problem if hwirq would be
unsigned; the compiler can generate better code in that case.


Segher

      reply	other threads:[~2008-04-23 16:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-19  9:27 [PATCH 1/3] MSI driver for Freescale 83xx/85xx/86xx cpu Jason Jin
     [not found] ` <1208597267-30960-2-git-send-email-Jason.jin@freescale.com>
2008-04-19  9:27   ` [PATCH 3/3] Enable MSI support for 85xxds board Jason Jin
2008-04-18 11:51     ` Segher Boessenkool
2008-04-21  6:21 ` [PATCH 1/3] MSI driver for Freescale 83xx/85xx/86xx cpu Michael Ellerman
2008-04-21 10:01   ` Jin Zhengxiong
2008-04-22  4:35     ` Michael Ellerman
2008-04-22  5:15       ` Jin Zhengxiong
2008-04-22 13:22       ` Segher Boessenkool
2008-04-23  5:45         ` Michael Ellerman
2008-04-23 16:05           ` Segher Boessenkool [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=8c9045cf69926c5ea881b780054e1c17@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=Jason.Jin@freescale.com \
    --cc=kumar.gala@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).