-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6ed056
commit f2e4883
Showing
27 changed files
with
202 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef __LIMITS_H__ | ||
#define __LIMITS_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define INT8_MIN (-1 - 0x7f) | ||
#define INT16_MIN (-1 - 0x7fff) | ||
#define INT32_MIN (-1 - 0x7fffffff) | ||
#define INT64_MIN (-1 - 0x7fffffffffffffff) | ||
|
||
#define INT8_MAX (0x7f) | ||
#define INT16_MAX (0x7fff) | ||
#define INT32_MAX (0x7fffffff) | ||
#define INT64_MAX (0x7fffffffffffffff) | ||
|
||
#define INT_MAX (0x7fffffff) | ||
|
||
#define UINT8_MAX (0xff) | ||
#define UINT16_MAX (0xffff) | ||
#define UINT32_MAX (0xffffffffU) | ||
#define UINT64_MAX (0xffffffffffffffffU) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif// __LIMITS_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
|
||
#include "timer.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef __STDARG_H__ | ||
#define __STDARG_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef __builtin_va_list va_list; | ||
|
||
/* | ||
* prepare to access variable args | ||
*/ | ||
#define va_start(v, l) __builtin_va_start(v, l) | ||
|
||
/* | ||
* the caller will get the value of current argument | ||
*/ | ||
#define va_arg(v, l) __builtin_va_arg(v, l) | ||
|
||
/* | ||
* end for variable args | ||
*/ | ||
#define va_end(v) __builtin_va_end(v) | ||
|
||
/* | ||
* copy variable args | ||
*/ | ||
#define va_copy(d, s) __builtin_va_copy(d, s) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __STDARG_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef __STDBOOL_H__ | ||
#define __STDBOOL_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
enum { | ||
false = 0, | ||
true = 1, | ||
}; | ||
|
||
typedef uint8_t bool; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // __STDBOOL_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __STDDEF_H__ | ||
#define __STDDEF_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if defined(__cplusplus) | ||
#define NULL (0) | ||
#else | ||
#define NULL ((void *) 0) | ||
#endif | ||
|
||
#if (defined(__GNUC__) && (__GNUC__ >= 4)) | ||
#define offsetof(type, member) __builtin_offsetof(type, member) | ||
#else | ||
#define offsetof(type, field) ((size_t) (&((type *) 0)->field)) | ||
#endif | ||
#define container_of(ptr, type, member) ({const typeof(((type *)0)->member) *__mptr = (ptr); (type *)((char *)__mptr - offsetof(type,member)); }) | ||
|
||
#if (defined(__GNUC__) && (__GNUC__ >= 3)) | ||
#define likely(expr) (__builtin_expect(!!(expr), 1)) | ||
#define unlikely(expr) (__builtin_expect(!!(expr), 0)) | ||
#else | ||
#define likely(expr) (!!(expr)) | ||
#define unlikely(expr) (!!(expr)) | ||
#endif | ||
|
||
#define min(a, b) (((a) < (b)) ? (a) : (b)) | ||
#define max(a, b) (((a) > (b)) ? (a) : (b)) | ||
|
||
#define clamp(v, a, b) min(max(a, v), b) | ||
|
||
#define ifloor(x) ((x) > 0 ? (int) (x) : (int) ((x) -0.9999999999)) | ||
#define iround(x) ((x) > 0 ? (int) ((x) + 0.5) : (int) ((x) -0.5)) | ||
#define iceil(x) ((x) > 0 ? (int) ((x) + 0.9999999999) : (int) (x)) | ||
#define idiv255(x) ((((int) (x) + 1) * 257) >> 16) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __STDDEF_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef __STDINT_H__ | ||
#define __STDINT_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <types.h> | ||
|
||
typedef signed char s8_t; | ||
typedef unsigned char u8_t; | ||
|
||
typedef signed short s16_t; | ||
typedef unsigned short u16_t; | ||
|
||
typedef signed int s32_t; | ||
typedef unsigned int u32_t; | ||
|
||
typedef signed long long s64_t; | ||
typedef unsigned long long u64_t; | ||
|
||
typedef signed long long intmax_t; | ||
typedef unsigned long long uintmax_t; | ||
|
||
typedef signed long long ptrdiff_t; | ||
typedef signed long long intptr_t; | ||
typedef unsigned long int uintptr_t; | ||
|
||
typedef s8_t int8_t; | ||
typedef u8_t uint8_t; | ||
|
||
typedef s16_t int16_t; | ||
typedef u16_t uint16_t; | ||
|
||
typedef s32_t int32_t; | ||
typedef u32_t uint32_t; | ||
|
||
typedef s64_t int64_t; | ||
typedef u64_t uint64_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __STDINT_H__ */ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.