diff options
Diffstat (limited to 'rgo/src/fndbyte.c')
-rw-r--r-- | rgo/src/fndbyte.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/rgo/src/fndbyte.c b/rgo/src/fndbyte.c index 29945a0..79b4aaf 100644 --- a/rgo/src/fndbyte.c +++ b/rgo/src/fndbyte.c @@ -6,6 +6,9 @@ #include <rgo-priv.h> +#include <stddef.h> +#include <stdint.h> + #if defined(rgo_priv_fastimpl) __asm__ ( ".global rgo_fndbyte\n" @@ -13,8 +16,8 @@ __asm__ ( "rgo_fndbyte:\n" /* void const * ptr - sus_typ_usz num - sus_typ_u8 byte + size_t num + uint_least8_t byte */ #if defined(sus_arch_amd64) /* rax: Address of the current element. */ @@ -65,10 +68,10 @@ __asm__ ( #endif ); #else -sus_typ_usz rgo_fndbyte(void const * const sus_restr _ptr,sus_typ_usz const _num,sus_typ_u8 const _byte) { - sus_typ_u8 const * ptr = (sus_typ_u8 const *)_ptr; - sus_typ_u8 const * const afterbuf = ptr + _num; - for (;ptr != afterbuf;++ptr) {sus_unlikely (*ptr == _byte) {return ptr - (sus_typ_u8 const *)_ptr;}} - return sus_typlit_usz(-0x1); +size_t rgo_fndbyte(void const * const _ptr,size_t const _num,uint_least8_t const _byte) { + uint_least8_t const * ptr = (uint_least8_t const *)_ptr; + uint_least8_t const * const afterbuf = ptr + _num; + for (;ptr != afterbuf;++ptr) {sus_unlikely (*ptr == _byte) {return ptr - (uint_least8_t const *)_ptr;}} + return rgo_typlit_usz(-0x1); } #endif |