From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7172ADE46F for ; Thu, 24 Apr 2008 02:06:04 +1000 (EST) In-Reply-To: <1208929545.9212.12.camel@concordia.ozlabs.ibm.com> References: <1208597267-30960-1-git-send-email-Jason.jin@freescale.com> <1208758907.9955.4.camel@concordia> <1208838916.12660.10.camel@concordia.ozlabs.ibm.com> <1208929545.9212.12.camel@concordia.ozlabs.ibm.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <8c9045cf69926c5ea881b780054e1c17@kernel.crashing.org> From: Segher Boessenkool Subject: Re: [PATCH 1/3] MSI driver for Freescale 83xx/85xx/86xx cpu Date: Wed, 23 Apr 2008 18:05:47 +0200 To: michael@ellerman.id.au Cc: linuxppc-dev list , Kumar Gala , Jin Zhengxiong List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , >>> 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