summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-26 02:50:13 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-26 02:50:13 +0000
commit6eb4415eaaaa2a01209262555f0a115a46deeb36 (patch)
tree6d96fed6363347ee595588a77b65cfe9eda0f711 /include
parent9ffbd8cdf7807e1621d2421f120aef668530b8da (diff)
include/libc-string_i386.h: fix a bug where memset('\xff') misbehaves
Rules.mak: add -funsigned-char, to forestall future PITA
Diffstat (limited to 'include')
-rw-r--r--include/libc-string_i386.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/libc-string_i386.h b/include/libc-string_i386.h
index 3ed9c8783..3eefdeb76 100644
--- a/include/libc-string_i386.h
+++ b/include/libc-string_i386.h
@@ -26,7 +26,9 @@ void *inlined_memset_const_c_count4(void *s, unsigned eax, unsigned count)
return s;
}
- eax *= 0x01010101; /* done at compile time */
+ /* You wonder why & 0xff is needed? Try memset(p, '\xff', size).
+ * If char is signed, '\xff' == -1! */
+ eax = (eax & 0xff) * 0x01010101; /* done at compile time */
if (count == 2) {
*(short *)(s + 0) = eax;