From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6341 invoked by alias); 24 May 2012 15:01:30 -0000 Received: (qmail 6321 invoked by uid 22791); 24 May 2012 15:01:28 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 May 2012 15:01:10 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4OF1AmK010881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 May 2012 11:01:10 -0400 Received: from host2.jankratochvil.net (ovpn-116-78.ams2.redhat.com [10.36.116.78]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4OF16B8006948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 24 May 2012 11:01:08 -0400 Date: Thu, 24 May 2012 15:01:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [PATCH v2] Expand bitpos and type.length to LONGEST and ULONGEST Message-ID: <20120524150105.GA8232@host2.jankratochvil.net> References: <20120220132724.GB4753@spoyarek.pnq.redhat.com> <20120221210235.GA26897@host2.jankratochvil.net> <20120504183858.67d416b7@spoyarek> <20120515200454.GA11338@host2.jankratochvil.net> <20120523192245.0f785e69@spoyarek> <20120523174610.GA23405@host2.jankratochvil.net> <20120524070634.4e346d9d@spoyarek> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120524070634.4e346d9d@spoyarek> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00927.txt.bz2 On Thu, 24 May 2012 03:36:34 +0200, Siddhesh Poyarekar wrote: > On Wed, 23 May 2012 19:46:10 +0200, Jan wrote: > > On Wed, 23 May 2012 15:52:45 +0200, Siddhesh Poyarekar wrote: > > > > > static void > > > > > -copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits, > > > > > - const gdb_byte *source, unsigned int > > > > > source_offset_bits, > > > > > - unsigned int bit_count, > > > > > +copy_bitwise (gdb_byte *dest, ULONGEST dest_offset_bits, > > > > > + const gdb_byte *source, ULONGEST source_offset, > > > > > + ULONGEST bit_count, > > > > > int bits_big_endian) > > > > > { > > > > > - unsigned int dest_avail; > > > > > + unsigned int dest_avail, source_offset_bits; > > > > > int datum; > > > > > > > > > > /* Reduce everything to byte-size pieces. */ > > > > > dest += dest_offset_bits / 8; > > > > > dest_offset_bits %= 8; > > > > > - source += source_offset_bits / 8; > > > > > - source_offset_bits %= 8; > > > > > + source += source_offset / 8; > > > > > + source_offset_bits = source_offset % 8; [...] > dest_offset_bits is safe to be truncated when passing into insert_bits. > The trouble with source_offset_bits is that its pointer is passed into > extract_bits, because of which the function signature change becomes > non-optional unless just a cast is OK here. Understood/agreed, due to: datum = extract_bits (&source, &source_offset_bits, 8, bits_big_endian); Thanks, Jan