From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Wed, 21 Apr 2010 11:03:06 -0400 From: geoff@plan9.bell-labs.com To: 9fans@9fans.net In-Reply-To: <20100421134019.GA1382@polynum.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Integer arithmetic: some lessons Topicbox-Message-UUID: 0b815530-ead6-11e9-9d60-3106f5b1d025 If you think that shift operators aren't being translated to shift instructions, you can examine the output of 8c -S. x/2 is equal to x>>1 for non-negative integer x; for negative x, the two expressions may yield different values, even if x is a signed integer. The book Hacker's Delight, among others, explores these sorts of optimisations.