• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónf3e08e7fa2a364545aba165ff89b8a54f5ef723d (tree)
Tiempo2020-09-22 22:54:04
AutorYann Sionneau <ysionneau@kalr...>
CommiterWaldemar Brodkorb

Log Message

Fix warning due to unused variable in strlen

Fixes this:

libc/string/generic/strlen.c: In function 'strlen':
libc/string/generic/strlen.c:31:31: warning: variable 'magic_bits' set but not used [-Wunused-but-set-variable]

unsigned long int longword, magic_bits, himagic, lomagic;
~

Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>

Cambiar Resumen

Diferencia incremental

--- a/libc/string/generic/strlen.c
+++ b/libc/string/generic/strlen.c
@@ -28,7 +28,7 @@ size_t strlen (const char *str)
2828 {
2929 const char *char_ptr;
3030 const unsigned long int *longword_ptr;
31- unsigned long int longword, magic_bits, himagic, lomagic;
31+ unsigned long int longword, himagic, lomagic;
3232
3333 /* Handle the first few characters by reading one character at a time.
3434 Do this until CHAR_PTR is aligned on a longword boundary. */
@@ -52,14 +52,12 @@ size_t strlen (const char *str)
5252
5353 The 1-bits make sure that carries propagate to the next 0-bit.
5454 The 0-bits provide holes for carries to fall into. */
55- magic_bits = 0x7efefeffL;
5655 himagic = 0x80808080L;
5756 lomagic = 0x01010101L;
5857 if (sizeof (longword) > 4)
5958 {
6059 /* 64-bit version of the magic. */
6160 /* Do the shift in two steps to avoid a warning if long has 32 bits. */
62- magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
6361 himagic = ((himagic << 16) << 16) | himagic;
6462 lomagic = ((lomagic << 16) << 16) | lomagic;
6563 }
@@ -102,22 +100,7 @@ size_t strlen (const char *str)
102100
103101 longword = *longword_ptr++;
104102
105- if (
106-#if 0
107- /* Add MAGIC_BITS to LONGWORD. */
108- (((longword + magic_bits)
109-
110- /* Set those bits that were unchanged by the addition. */
111- ^ ~longword)
112-
113- /* Look at only the hole bits. If any of the hole bits
114- are unchanged, most likely one of the bytes was a
115- zero. */
116- & ~magic_bits)
117-#else
118- ((longword - lomagic) & himagic)
119-#endif
120- != 0)
103+ if (((longword - lomagic) & himagic) != 0)
121104 {
122105 /* Which of the bytes was the zero? If none of them were, it was
123106 a misfire; continue the search. */