File: foundation_mem.c

package info (click to toggle)
haskell-basement 0.0.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,048 kB
  • sloc: haskell: 11,336; ansic: 63; makefile: 5
file content (14 lines) | stat: -rw-r--r-- 430 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>
#include <stdint.h>
#include "foundation_prim.h"

int _foundation_memcmp(const void *s1, FsOffset off1, const void *s2, FsOffset off2, FsCountOf n)
{
	return memcmp(s1 + off1, s2 + off2, n);
}

FsOffset _foundation_mem_findbyte(uint8_t * const arr, FsOffset startofs, FsOffset endofs, uint8_t ty)
{
    uint8_t *r = memchr(arr + startofs, ty, endofs - startofs);
    return ((r == NULL) ? endofs : r - arr);
}