From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18396 invoked by alias); 19 Feb 2008 18:30:21 -0000 Received: (qmail 18383 invoked by uid 22791); 19 Feb 2008 18:30:20 -0000 X-Spam-Check-By: sourceware.org Received: from mail.artimi.com (HELO mail.artimi.com) (194.72.81.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Feb 2008 18:30:00 +0000 Received: from mail.artimi.com ([192.168.1.3] RDNS failed) by mail.artimi.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Feb 2008 18:29:57 +0000 Received: from rainbow ([192.168.8.46]) by mail.artimi.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Feb 2008 18:29:57 +0000 From: "Dave Korn" To: References: <5800c1cc0802162157g3ac31acas4ae95585b9b2e263@mail.gmail.com><5800c1cc0802170641g68ab2e5fte724cd076412333@mail.gmail.com><20080217152625.GA4810@caradoc.them.org><47BB03ED.5060708@baymicrosystems.com><007f01c87324$00f45a90$2e08a8c0@CAM.ARTIMI.COM> <18363.7810.91075.314867@gargle.gargle.HOWL> Subject: RE: (len % 1) != 0 Date: Tue, 19 Feb 2008 18:35:00 -0000 Message-ID: <008001c87325$6db805e0$2e08a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <18363.7810.91075.314867@gargle.gargle.HOWL> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00135.txt.bz2 On 19 February 2008 18:23, Paul Koning wrote: >>>>>> "Dave" == Dave Korn writes: > > Dave> On 19 February 2008 16:30, Sheng-Liang Song wrote: > >> or > >> > >> (len & 1) != 0 <=> (len % 2) != 0 > >> > > Dave> That would have the advantage of not requiring a divide > Dave> operation :) > > It shouldn't matter -- the optimizer will do the right thing, as I > recall. NB len == signed int. Yes, it can simplify it to a bunch of shifts and sign extends and masks without using an explicit divide, but it's not as good as a simple AND operation. (Maybe VRP in 4.x could handle that by knowing that the result of strlen has to be >= 0, but 3.x series won't do it). cheers, DaveK -- Can't think of a witty .sigline today....