1#include "prism/internal/memchr.h"
7#define TRAILING_BYTE_MINIMUM 0x40
15pm_memchr(
const void *memory,
int character,
size_t number,
bool encoding_changed,
const pm_encoding_t *encoding) {
16 if (encoding_changed && encoding->multibyte && character >= TRAILING_BYTE_MINIMUM) {
17 const uint8_t *source = (
const uint8_t *) memory;
20 while (index < number) {
21 if (source[index] == character) {
22 return (
void *) (source + index);
25 size_t width = encoding->char_width(source + index, (ptrdiff_t) (number - index));
35 return memchr(memory, character, number);