1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-21 20:40:05 +00:00

lmem.[ch]: removed inlined functions

- fixes some builds
This commit is contained in:
CPunch 2022-09-07 16:53:14 -05:00
parent 6ab280d010
commit 674ea2b47b
2 changed files with 25 additions and 24 deletions

View File

@ -57,29 +57,7 @@
} while (0); } while (0);
void *laikaM_realloc(void *buf, size_t sz); void *laikaM_realloc(void *buf, size_t sz);
bool laikaM_isBigEndian(void);
inline bool laikaM_isBigEndian(void) void laikaM_reverse(uint8_t *buf, size_t sz);
{
union
{
uint32_t i;
uint8_t c[4];
} _indxint = {0xDEADB33F};
return _indxint.c[0] == 0xDE;
}
inline void laikaM_reverse(uint8_t *buf, size_t sz)
{
int k;
/* swap bytes, reversing the buffer */
for (k = 0; k < (sz / 2); k++) {
uint8_t tmp = buf[k];
buf[k] = buf[sz - k - 1];
buf[sz - k - 1] = tmp;
}
}
#endif #endif

View File

@ -18,3 +18,26 @@ void *laikaM_realloc(void *buf, size_t sz)
return newBuf; return newBuf;
} }
bool laikaM_isBigEndian(void)
{
union
{
uint32_t i;
uint8_t c[4];
} _indxint = {0xDEADB33F};
return _indxint.c[0] == 0xDE;
}
void laikaM_reverse(uint8_t *buf, size_t sz)
{
int k;
/* swap bytes, reversing the buffer */
for (k = 0; k < (sz / 2); k++) {
uint8_t tmp = buf[k];
buf[k] = buf[sz - k - 1];
buf[sz - k - 1] = tmp;
}
}