commit 710a8632f153d002f4e04d4e75135f0b784f456d
parent 6923c70cd7d7c58af4588fdbbb97fe8c5e50a0da
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Fri, 17 Jun 2022 12:49:08 -0400
cc: have typesize properly report the size of pointers
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/cc/type.fs b/fs/cc/type.fs
@@ -9,11 +9,11 @@
4 stringlist typenames "void" "char" "short" "int"
create _ 0 c, 8 c, 16 c, 32 c,
-: typesize ( type -- size-in-bytes ) 3 and _ + c@ ;
: typesigned? ( type -- flags ) 2 rshift 1 and ;
: type*lvl ( type -- lvl ) 3 rshift 3 and ;
: type*lvl! ( lvl type -- type ) $f and swap 3 lshift or ;
: type*lvl+ ( type -- type ) dup type*lvl 1+ swap type*lvl! ;
+: typesize ( type -- size-in-bytes ) dup type*lvl if 4 else 3 and _ + c@ then ;
\ Unlike ANSI C, "signed" doesn't exist and "unsigned" needs to be before the
\ type name. '*' are not parsed because they are sometimes attached to the