[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay bomb.sh/docs/tty
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445/* mem.c — memcpy/memset shims for freestanding wasm32 */
#include "mem.h"
void *memcpy(void *dst, const void *src, size_t n) { unsigned char *d = (unsigned char *)dst; const unsigned char *s = (const unsigned char *)src; while (n--) *d++ = *s++; return dst;}
void *memmove(void *dst, const void *src, size_t n) { unsigned char *d = (unsigned char *)dst; const unsigned char *s = (const unsigned char *)src; if (d == s || n == 0) return dst; if (d < s) { while (n--) *d++ = *s++; } else { d += n; s += n; while (n--) *--d = *--s; } return dst;}
void *memset(void *dst, int c, size_t n) { unsigned char *d = (unsigned char *)dst; while (n--) *d++ = (unsigned char)c; return dst;}
size_t strlen(const char *s) { size_t n = 0; while (s[n]) n++; return n;}
int align8(int n) { return (n + 7) & ~7; }