ARM Patch: correctly deal with big-endian string termination

Jeff Johnston jjohnstn@redhat.com
Thu Mar 26 03:29:00 GMT 2009


Patch checked in.

-- Jeff J.

Richard Earnshaw wrote:
> If a word loaded from the string being compared contains the byte-pair
> 0x01000 at any position within the word (ie 0xXXXX0100, 0xXX0100XX or
> 0x0100XXXX) then the syndrome value calculated by the zero-detection
> algorithm will contain 0x8080 at the position of these two bytes.
>
> On a little-endian machine this makes no difference to the behaviour of
> the algorithm because the interesting bytes (if any) are in the least
> significant part of the word; but on big-endian machines the 0x01 byte
> is the last byte in the string.  We therefore have to handle this case
> by testing each of the last bytes explicitly.
>
> 2009-03-24  Richard Earnshaw  <rearnsha@arm.com>
>
> 	* libc/machine/arm/strcmp.c (strcmp_unaligned): Correctly
> 	detect the nul-byte in a big-endian string.
>
>
>   



More information about the Newlib mailing list