From: Sebastien Bourdeauducq Date: Fri, 25 May 2012 20:30:17 +0000 (+0200) Subject: software/libbase: stddef.h X-Git-Tag: 24jan2021_ls180~3163 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd546edc1903e009dea4c25b18f345f35869deaf;p=litex.git software/libbase: stddef.h --- diff --git a/software/include/base/stddef.h b/software/include/base/stddef.h new file mode 100644 index 00000000..331f39e7 --- /dev/null +++ b/software/include/base/stddef.h @@ -0,0 +1,11 @@ +#ifndef __STDDEF_H +#define __STDDEF_H + +#define NULL ((void *)0) + +typedef unsigned long size_t; +typedef long ptrdiff_t; + +#define offsetof(s,m) (size_t)&(((s *)0)->m) + +#endif /* __STDDEF_H */ diff --git a/software/include/base/stdlib.h b/software/include/base/stdlib.h index cea677d5..7d2e2508 100644 --- a/software/include/base/stdlib.h +++ b/software/include/base/stdlib.h @@ -19,6 +19,8 @@ #ifndef __STDLIB_H #define __STDLIB_H +#include + #define PRINTF_ZEROPAD 1 /* pad with zero */ #define PRINTF_SIGN 2 /* unsigned/signed long */ #define PRINTF_PLUS 4 /* show plus */ @@ -27,11 +29,6 @@ #define PRINTF_SPECIAL 32 /* 0x */ #define PRINTF_LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ -typedef unsigned long size_t; -typedef long ptrdiff_t; - -#define NULL ((void *)0) - #define likely(x) x #define unlikely(x) x