diff mbox series

[V2,01/10] libc: Expand limits.h and include in stdint.h

Message ID 20220315124914.51569-2-clombard@linux.vnet.ibm.com
State Superseded
Headers show
Series Import external libraries for MCTP/PLDM protocols | expand

Commit Message

Christophe Lombard March 15, 2022, 12:49 p.m. UTC
Add maximum native integer size and limits of specified-width integer
types.
These types are required by the external library: libpldm.

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
---
 libc/include/limits.h | 6 ++++++
 libc/include/stdint.h | 3 +++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/libc/include/limits.h b/libc/include/limits.h
index bfde9635..09f054a2 100644
--- a/libc/include/limits.h
+++ b/libc/include/limits.h
@@ -33,5 +33,11 @@ 
 
 #define 	UINT32_MAX	UINT_MAX
 #define 	INT32_MAX	INT_MAX
+#define 	UINT16_MAX	USHRT_MAX
+#define 	UINT8_MAX	UCHAR_MAX
+
+#ifndef SIZE_MAX
+#define SIZE_MAX (~0ull)
+#endif
 
 #endif
diff --git a/libc/include/stdint.h b/libc/include/stdint.h
index 2a2c1d91..080d875a 100644
--- a/libc/include/stdint.h
+++ b/libc/include/stdint.h
@@ -13,6 +13,9 @@ 
 #ifndef _STDINT_H
 #define _STDINT_H
 
+/* C99 requires *_MAX to be in stdint.h */
+#include <limits.h>
+
 typedef unsigned char uint8_t;
 typedef signed char int8_t;