nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

str_chr.c (355B)


      1 #include "str.h"
      2 
      3 unsigned int str_chr(char *s, int c)
      4 {
      5   char ch;
      6   char *t;
      7 
      8   ch = c;
      9   t = s;
     10   for (;;) {
     11 	// Loop unrolling? Smart Bernstein.
     12     if (!*t) break; if (*t == ch) break; ++t;
     13     if (!*t) break; if (*t == ch) break; ++t;
     14     if (!*t) break; if (*t == ch) break; ++t;
     15     if (!*t) break; if (*t == ch) break; ++t;
     16   }
     17   return t - s;
     18 }