Refactor structures more.

This commit is contained in:
Brad Nelson
2024-11-29 16:21:00 -08:00
parent 2ca333a0fa
commit 9ae74fa183

View File

@ -17,18 +17,18 @@
vocabulary structures structures definitions
variable last-align
: typer ( align sz "name" ) create , ,
does> dup cell+ @ last-align ! @ ;
1 1 typer i8
2 2 typer i16
4 4 typer i32
cell 8 typer i64
cell cell typer ptr
long-size long-size typer long
: typer ( sz "name" ) create dup , 1 max cell min ,
does> dup cell+ @ last-align ! @ ;
1 typer i8
2 typer i16
4 typer i32
8 typer i64
cell typer ptr
long-size typer long
variable last-struct
: struct ( "name" ) 1 0 typer latestxt >body last-struct !
: struct ( "name" ) 0 typer latestxt >body last-struct !
1 last-align ! ;
: align-by ( a n -- a ) 1- dup >r + r> invert and ;
: max! ( n a -- ) swap over @ max swap ! ;