From 482afa411be873d03c47e3f74f6ce711bdb7cc47 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 19 Sep 2022 10:38:49 +0200 Subject: [PATCH] :art: Low Level plugs --- plug | 2 +- src/lib/prim.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plug b/plug index b37656de..1f26e305 160000 --- a/plug +++ b/plug @@ -1 +1 @@ -Subproject commit b37656de3f53e761b1c51c35e5711f02d137e4cc +Subproject commit 1f26e30582f4afe45e2fb40c0015b1ef0f68237e diff --git a/src/lib/prim.c b/src/lib/prim.c index 8afe8059..07a78a04 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -622,8 +622,32 @@ static GWION_IMPORT(float) { return GW_OK; } +static GACK(gack_u8) { + INTERP_PRINTF("%u", *(uint8_t*)VALUE); +} + +static GACK(gack_u16) { + INTERP_PRINTF("%u", *(uint16_t*)VALUE); +} + +static GACK(gack_u32) { + INTERP_PRINTF("%u", *(uint32_t*)VALUE); +} + GWION_IMPORT(prim) { GWI_BB(import_int(gwi)) // const folded + imm optimized + const Type t_u8 = gwi_mk_type(gwi, "u8", SZ_INT, "int"); + t_u8->actual_size = 1; + gwi_gack(gwi, t_u8, gack_u8); + gwi_add_type(gwi, t_u8); + const Type t_u16 = gwi_mk_type(gwi, "u16", SZ_INT, "int"); + t_u16->actual_size = 2; + gwi_gack(gwi, t_u16, gack_u16); + gwi_add_type(gwi, t_u16); + const Type t_u32 = gwi_mk_type(gwi, "u32", SZ_INT, "int"); + t_u32->actual_size = 4; + gwi_gack(gwi, t_u32, gack_u32); + gwi_add_type(gwi, t_u32); GWI_BB(import_float(gwi)) // const folded GWI_BB(import_intfloat(gwi)) // const folded GWI_BB(import_floatint(gwi)) // const folded -- 2.43.0