Revisión | f3e08e7fa2a364545aba165ff89b8a54f5ef723d (tree) |
---|---|
Tiempo | 2020-09-22 22:54:04 |
Autor | Yann Sionneau <ysionneau@kalr...> |
Commiter | Waldemar Brodkorb |
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]
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
@@ -28,7 +28,7 @@ size_t strlen (const char *str) | ||
28 | 28 | { |
29 | 29 | const char *char_ptr; |
30 | 30 | const unsigned long int *longword_ptr; |
31 | - unsigned long int longword, magic_bits, himagic, lomagic; | |
31 | + unsigned long int longword, himagic, lomagic; | |
32 | 32 | |
33 | 33 | /* Handle the first few characters by reading one character at a time. |
34 | 34 | Do this until CHAR_PTR is aligned on a longword boundary. */ |
@@ -52,14 +52,12 @@ size_t strlen (const char *str) | ||
52 | 52 | |
53 | 53 | The 1-bits make sure that carries propagate to the next 0-bit. |
54 | 54 | The 0-bits provide holes for carries to fall into. */ |
55 | - magic_bits = 0x7efefeffL; | |
56 | 55 | himagic = 0x80808080L; |
57 | 56 | lomagic = 0x01010101L; |
58 | 57 | if (sizeof (longword) > 4) |
59 | 58 | { |
60 | 59 | /* 64-bit version of the magic. */ |
61 | 60 | /* Do the shift in two steps to avoid a warning if long has 32 bits. */ |
62 | - magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; | |
63 | 61 | himagic = ((himagic << 16) << 16) | himagic; |
64 | 62 | lomagic = ((lomagic << 16) << 16) | lomagic; |
65 | 63 | } |
@@ -102,22 +100,7 @@ size_t strlen (const char *str) | ||
102 | 100 | |
103 | 101 | longword = *longword_ptr++; |
104 | 102 | |
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) | |
121 | 104 | { |
122 | 105 | /* Which of the bytes was the zero? If none of them were, it was |
123 | 106 | a misfire; continue the search. */ |