mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03:37 +01:00
use a variant of <endian.h> on Mac OS
This commit is contained in:
parent
5cdc20ed1f
commit
7efd917cf2
7 changed files with 71 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <endian.h>
|
#include <endianness.h>
|
||||||
|
|
||||||
#include <fxg1a.h>
|
#include <fxg1a.h>
|
||||||
#include <g1a.h>
|
#include <g1a.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <fxg1a.h>
|
#include <fxg1a.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <endian.h>
|
#include <endianness.h>
|
||||||
|
|
||||||
/* sign(): Sign header by filling fixed fields and checksums */
|
/* sign(): Sign header by filling fixed fields and checksums */
|
||||||
void sign(struct g1a *g1a, size_t size)
|
void sign(struct g1a *g1a, size_t size)
|
||||||
|
|
33
fxg1a/endianness.h
Normal file
33
fxg1a/endianness.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//---
|
||||||
|
// Cross-platform endianness conversion. (seriously?)
|
||||||
|
//---
|
||||||
|
|
||||||
|
#ifndef FX_ENDIANNESS
|
||||||
|
#define FX_ENDIANNESS
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#include <libkern/OSByteOrder.h>
|
||||||
|
|
||||||
|
#define htobe16(x) OSSwapHostToBigInt16(x)
|
||||||
|
#define htole16(x) OSSwapHostToLittleInt16(x)
|
||||||
|
#define be16toh(x) OSSwapBigToHostInt16(x)
|
||||||
|
#define le16toh(x) OSSwapLittleToHostInt16(x)
|
||||||
|
|
||||||
|
#define htobe32(x) OSSwapHostToBigInt32(x)
|
||||||
|
#define htole32(x) OSSwapHostToLittleInt32(x)
|
||||||
|
#define be32toh(x) OSSwapBigToHostInt32(x)
|
||||||
|
#define le32toh(x) OSSwapLittleToHostInt32(x)
|
||||||
|
|
||||||
|
#define htobe64(x) OSSwapHostToBigInt64(x)
|
||||||
|
#define htole64(x) OSSwapHostToLittleInt64(x)
|
||||||
|
#define be64toh(x) OSSwapBigToHostInt64(x)
|
||||||
|
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_ENDIANNESS */
|
|
@ -1,5 +1,5 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <endian.h>
|
#include <endianness.h>
|
||||||
#include <fxg1a.h>
|
#include <fxg1a.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
33
fxos/endianness.h
Normal file
33
fxos/endianness.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//---
|
||||||
|
// Cross-platform endianness conversion. (seriously?)
|
||||||
|
//---
|
||||||
|
|
||||||
|
#ifndef FX_ENDIANNESS
|
||||||
|
#define FX_ENDIANNESS
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#include <libkern/OSByteOrder.h>
|
||||||
|
|
||||||
|
#define htobe16(x) OSSwapHostToBigInt16(x)
|
||||||
|
#define htole16(x) OSSwapHostToLittleInt16(x)
|
||||||
|
#define be16toh(x) OSSwapBigToHostInt16(x)
|
||||||
|
#define le16toh(x) OSSwapLittleToHostInt16(x)
|
||||||
|
|
||||||
|
#define htobe32(x) OSSwapHostToBigInt32(x)
|
||||||
|
#define htole32(x) OSSwapHostToLittleInt32(x)
|
||||||
|
#define be32toh(x) OSSwapBigToHostInt32(x)
|
||||||
|
#define le32toh(x) OSSwapLittleToHostInt32(x)
|
||||||
|
|
||||||
|
#define htobe64(x) OSSwapHostToBigInt64(x)
|
||||||
|
#define htole64(x) OSSwapHostToLittleInt64(x)
|
||||||
|
#define be64toh(x) OSSwapBigToHostInt64(x)
|
||||||
|
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_ENDIANNESS */
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <endian.h>
|
#include <endianness.h>
|
||||||
|
|
||||||
char const *info_str =
|
char const *info_str =
|
||||||
"Header information:\n"
|
"Header information:\n"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <endian.h>
|
#include <endianness.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <fxos.h>
|
#include <fxos.h>
|
||||||
|
|
Loading…
Reference in a new issue