1 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
2 <link rel="stylesheet" href="style.css" type="text/css"/>
3 <script src="code.js" type="text/javascript"></script>
5 <h1>glibc strlen (part 2)</h1>
8 const unsigned long int *longword_ptr;
9 unsigned long int longword, himagic, lomagic;
11 longword_ptr = (unsigned long int *) char_ptr;
13 himagic = 0x80808080L;
14 lomagic = 0x01010101L;
15 himagic = ((himagic << 16) << 16) | himagic;
16 lomagic = ((lomagic << 16) << 16) | lomagic;
20 longword = *longword_ptr++;
22 if (((longword - lomagic) & ~longword & himagic) != 0)
24 <span class="comment">/* Which of the bytes was the zero? If none of them were, it was
25 a misfire; continue the search. */</span>
27 const char *cp = (const char *) (longword_ptr - 1);
37 if (sizeof (longword) > 4)