[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [ Bug #1720 ] memcmp bug ?
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] [ Bug #1720 ] memcmp bug ? |
Date: |
Mon, 18 Nov 2002 22:08:43 +0100 |
User-agent: |
Mutt/1.2.5i |
As Theodore A. Roth wrote:
> http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=1720&group_id=2140
>
> Is this really a bug?
Yes, it is:
``7.21.4 Comparison functions
The sign of a nonzero value returned by the comparison functions memcmp,
strcmp, and strncmp is determined by the sign of the difference between
the values of the first pair of characters (both interpreted as unsigned
char) that differ in the objects being compared.''
> If the change should be made, I think it would be the following patch
> (don't sign extend the result). Is this patch correct?
> .memcmp_done:
> -; ret_hi = SREG.C ? 0xFF : 0
> - sbc ret_hi, ret_hi
> ret
Not yet. It needs a clr ret_hi, since the upper byte must be made
0.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/