adding more elaborate directive example

This commit is contained in:
mlokr 2024-06-15 09:37:19 +02:00
parent 655aabd686
commit f4e7cc49c8
7 changed files with 15 additions and 7 deletions

View file

@ -4,5 +4,13 @@ Type := struct {
} }
main := fn(): int { main := fn(): int {
return @eca(int, 1, Type.(10, 20), @sizeof(Type), @alignof(Type), 5, 6); byte := @as(u8, 10);
same_type_as_byte := @as(@TypeOf(byte), 30);
wide_uint := @as(u32, 40);
truncated_uint := @as(u8, @intcast(wide_uint));
size_of_Type_in_bytes := @sizeof(Type);
align_of_Type_in_bytes := @alignof(Type);
hardcoded_pointer := @as(^u8, @bitcast(10));
ecall_that_returns_int := @eca(int, 1, Type.(10, 20), 5, 6);
return 0;
} }

View file

@ -1,3 +1,3 @@
code size: 477 code size: 471
ret: 512 ret: 512
status: Ok(()) status: Ok(())

View file

@ -1,4 +1,4 @@
ev: Ecall ev: Ecall
code size: 182 code size: 235
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,3 +1,3 @@
code size: 85 code size: 82
ret: 1 ret: 1
status: Ok(()) status: Ok(())

View file

@ -1,3 +1,3 @@
code size: 525 code size: 513
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,3 +1,3 @@
code size: 265 code size: 262
ret: 55 ret: 55
status: Ok(()) status: Ok(())

View file

@ -1,3 +1,3 @@
code size: 420 code size: 417
ret: 3 ret: 3
status: Ok(()) status: Ok(())