From b60cb1fb00f97801dc3ac3adab08febd918a5681 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 2 Aug 2024 00:27:14 +0900 Subject: [PATCH] valtype.h: change the way to define constants no functional changes are intended. --- lib/valtype.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/valtype.h b/lib/valtype.h index 10a38a5e..b262fa84 100644 --- a/lib/valtype.h +++ b/lib/valtype.h @@ -6,20 +6,22 @@ * they can be distinguished from typeidx in eg. block types. */ +#define _S7(x) (0x7f & (uint8_t)(x)) + enum valtype { /* numtype */ - TYPE_i32 = 0x7f, /* -0x01 */ - TYPE_i64 = 0x7e, /* -0x02 */ - TYPE_f32 = 0x7d, /* -0x03 */ - TYPE_f64 = 0x7c, /* -0x04 */ + TYPE_i32 = _S7(-0x01), + TYPE_i64 = _S7(-0x02), + TYPE_f32 = _S7(-0x03), + TYPE_f64 = _S7(-0x04), /* vectype */ - TYPE_v128 = 0x7b, /* -0x05 */ + TYPE_v128 = _S7(-0x05), /* reftype */ - TYPE_EXNREF = 0x69, /* -0x17 */ - TYPE_FUNCREF = 0x70, /* -0x10 */ - TYPE_EXTERNREF = 0x6f, /* -0x11 */ + TYPE_EXNREF = _S7(-0x17), + TYPE_FUNCREF = _S7(-0x10), + TYPE_EXTERNREF = _S7(-0x11), /* pseudo types for validation logic */ TYPE_ANYREF = 0xfe, /* any reftype */