diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/endian.h | 17 | ||||
-rw-r--r-- | include/stddef.h | 7 | ||||
-rw-r--r-- | include/stdint.h | 19 | ||||
-rw-r--r-- | include/string.h | 8 |
4 files changed, 51 insertions, 0 deletions
diff --git a/include/endian.h b/include/endian.h new file mode 100644 index 0000000..79b4c93 --- /dev/null +++ b/include/endian.h @@ -0,0 +1,17 @@ +#ifndef _ENDIAN_H +#define _ENDIAN_H + +#include <stdint.h> + +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 +#define BYTE_ORDER __BYTE_ORDER__ + +static inline uint32_t +__bswap32(uint32_t x) +{ + uint8_t *p = (uint8_t*)&x; + return ((p[0] << 030) | (p[1] << 020) | (p[2] << 010) | p[3]); +} + +#endif /* _ENDIAN_H */ diff --git a/include/stddef.h b/include/stddef.h new file mode 100644 index 0000000..998f53d --- /dev/null +++ b/include/stddef.h @@ -0,0 +1,7 @@ +#ifndef _STDDEF_H +#define _STDDEF_H + +#define NULL ((void*)0) +typedef unsigned long size_t; + +#endif /* _STDDEF_H_ */ diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 0000000..4afd32d --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,19 @@ +#ifndef _STDINT_H +#define _STDINT_H + + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long uint64_t; + + +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long int64_t; + + +#endif /* _STDINT_H */ + + diff --git a/include/string.h b/include/string.h new file mode 100644 index 0000000..a8edd63 --- /dev/null +++ b/include/string.h @@ -0,0 +1,8 @@ +#ifndef _STRING_H +#define _STRING_H + +#include <stddef.h> + +void *memset(void *s, int c, size_t n); + +#endif /* _STRING_H */ |