summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_count.c
blob: 5e3f8af53d7881f98dec5e5ea8a15a86af169172 (plain)
1
2
3
4
5
6
7
8
9
10
/* ISC license. */

#include <skalibs/bytestr.h>

unsigned int byte_count (register char const *s, register unsigned int len, register char b)
{
  register unsigned int n = 0 ;
  while (len--) if (*s++ == b) n++ ;
  return n ;
}