Import gx, PadClamp, rest of mtx, TRK 2.6 and MSL (#525)

* Match mtx and Padclamp.c

* Match the rest of GX

* Import TRK 2.6

* Import MSL headers and files

* Merge some MSL headers into ours
This commit is contained in:
dbalatoni13 2025-01-12 15:11:23 +01:00 committed by GitHub
parent a79294aac0
commit cdb1d1fc37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
113 changed files with 11219 additions and 394 deletions

View file

@ -0,0 +1,75 @@
#include "string.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h"
void* memmove(void* dst, const void* src, size_t n)
{
unsigned char* csrc;
unsigned char* cdst;
int reverse = (unsigned int)src < (unsigned int)dst;
if (n >= 32) {
if (((unsigned int)dst ^ (unsigned int)src) & 3) {
if (!reverse) {
__copy_longs_unaligned(dst, src, n);
} else {
__copy_longs_rev_unaligned(dst, src, n);
}
} else {
if (!reverse) {
__copy_longs_aligned(dst, src, n);
} else {
__copy_longs_rev_aligned(dst, src, n);
}
}
return dst;
} else {
if (!reverse) {
csrc = ((unsigned char*)src) - 1;
cdst = ((unsigned char*)dst) - 1;
n++;
while (--n > 0) {
*++cdst = *++csrc;
}
} else {
csrc = (unsigned char*)src + n;
cdst = (unsigned char*)dst + n;
n++;
while (--n > 0) {
*--cdst = *--csrc;
}
}
}
return dst;
}
void* memchr(const void* ptr, int ch, size_t count)
{
const unsigned char* p;
unsigned long v = (ch & 0xff);
for (p = (unsigned char*)ptr - 1, count++; --count;)
if ((*++p & 0xff) == v)
return (void*)p;
return NULL;
}
int memcmp(const void* lhs, const void* rhs, size_t count)
{
const unsigned char* p1;
const unsigned char* p2;
for (p1 = (const unsigned char*)lhs - 1, p2 = (const unsigned char*)rhs - 1,
count++;
--count;)
if (*++p1 != *++p2)
return ((*p1 < *p2) ? -1 : +1);
return 0;
}