This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH [2/2] Convert the unavailable vector to be bit, not byte, based.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <aburgess at broadcom dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 11 Dec 2013 18:45:07 +0000
- Subject: Re: [PATCH [2/2] Convert the unavailable vector to be bit, not byte, based.
- Authentication-results: sourceware.org; auth=none
- References: <529F489F dot 7070805 at broadcom dot com> <529F498F dot 7060909 at broadcom dot com> <52A8929E dot 20608 at broadcom dot com>
On 12/11/2013 04:28 PM, Andrew Burgess wrote:
> +
> + It is assumed that memory can be accessed from:
> + PTR + (OFFSET_BITS / TARGET_CHAR_BIT)
> + to:
> + PTR + ((OFFSET_BITS + TARGET_CHAR_BIT - 1)/ TARGET_CHAR_BIT) */
The "to:" part doesn't look right -- LENGTH_BITS seems to be
missing somewhere? Also, missing space before second "/".
> + bits = TARGET_CHAR_BIT - (offset1_bits % TARGET_CHAR_BIT);
Unnecessary parens.
> + b1 = *((bfd_byte *) ((uintptr_t) ptr1 + (o1 / TARGET_CHAR_BIT)));
> + b2 = *((bfd_byte *) ((uintptr_t) ptr2 + (o2 / TARGET_CHAR_BIT)));
No need for uintptr_t, nor the rightmost set of parens:
b1 = *((bfd_byte *) ptr1 + o1 / TARGET_CHAR_BIT);
b2 = *((bfd_byte *) ptr2 + o2 / TARGET_CHAR_BIT);
There may be other instances of unneeded parens. I won't point
them all out.
> + return memcmp ((void*) ((uintptr_t) ptr1
> + + (offset1_bits / TARGET_CHAR_BIT)),
> + (void*) ((uintptr_t) ptr2
> + + (offset2_bits / TARGET_CHAR_BIT)),
> + length_bits / TARGET_CHAR_BIT);
Space before *. Parens.
Otherwise looks OK. Thanks a lot for doing this!
--
Pedro Alves