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.
This commit is contained in:
Damien George
2016-02-02 23:16:05 +00:00
parent 086d98cbde
commit 5f3e005b67
4 changed files with 31 additions and 28 deletions

View File

@@ -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__