From 5f3e005b6791634b104fa6385c8a9bf5ed1af164 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 2 Feb 2016 23:16:05 +0000 Subject: py: Extend native type-sig to use 4 bits, so uint is separate to ptr. Before this patch, the native types for uint and ptr/ptr8/ptr16/ptr32 all overlapped and it was possible to make a mistake in casting. Now, these types are all separate and any coding mistakes will be raised as runtime errors. --- py/runtime0.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'py/runtime0.h') diff --git a/py/runtime0.h b/py/runtime0.h index 6417cfd034..8d62403a7c 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -37,6 +37,10 @@ #define MP_NATIVE_TYPE_BOOL (0x01) #define MP_NATIVE_TYPE_INT (0x02) #define MP_NATIVE_TYPE_UINT (0x03) +#define MP_NATIVE_TYPE_PTR (0x04) +#define MP_NATIVE_TYPE_PTR8 (0x05) +#define MP_NATIVE_TYPE_PTR16 (0x06) +#define MP_NATIVE_TYPE_PTR32 (0x07) typedef enum { MP_UNARY_OP_BOOL, // __bool__ -- cgit v1.2.3