[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [ Bug #1720 ] memcmp bug ?
From: |
Theodore A. Roth |
Subject: |
[avr-libc-dev] [ Bug #1720 ] memcmp bug ? |
Date: |
Mon, 18 Nov 2002 11:34:07 -0800 (PST) |
Regarding:
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=1720&group_id=2140
Is this really a bug?
I did a google search and found these:
http://tigcc.ticalc.org/doc/mem.html#memcmp
http://216.239.33.100/search?q=cache:MOUn1YX5j6sC:www.htsoft.com/htmlman/picc18/library.htm+memcmp+signed+bytes&hl=en&ie=UTF-8
which seem to imply that the compare is signed. But these imply the
compare is unsigned:
http://www.cs.vu.nl/pub/minix/2.0.2/wwwman/man3/string.3.html
http://soma.bkbits.net:8080/linux-arm-2.4-somaport/anno/lib/address@hidden@address@hidden
I'm leaning toward leaving the behaviour as is, but adding a note in the
dox explaining the signed nature of the compare operation.
If the change should be made, I think it would be the following patch
(don't sign extend the result). Is this patch correct?
Index: libc/string/memcmp.S
===================================================================
RCS file: /cvsroot/avr-libc/avr-libc/libc/string/memcmp.S,v
retrieving revision 1.3
diff -u -r1.3 memcmp.S
--- libc/string/memcmp.S 5 Aug 2002 19:21:36 -0000 1.3
+++ libc/string/memcmp.S 18 Nov 2002 19:28:15 -0000
@@ -68,8 +68,6 @@
; strings are equal, so clear both ret_lo and carry
sub ret_lo, ret_lo
.memcmp_done:
-; ret_hi = SREG.C ? 0xFF : 0
- sbc ret_hi, ret_hi
ret
.memcmp_end:
.size _U(memcmp), .memcmp_end - _U(memcmp)
Ted Roth
- [avr-libc-dev] [ Bug #1720 ] memcmp bug ?,
Theodore A. Roth <=