summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_rchr.c
blob: 3564c3635664b46f1ba34ffedaf80572ea7687ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <skalibs/bytestr.h>

unsigned int byte_rchr (register char const *s, unsigned int n, int c)
{
  register unsigned int i = n ;
  register char ch = c ;
  s += n ;
  while (i--) if (*--s == ch) return i ;
  return n ;
}