boxing.factor: Use count

master
kusumotonorio 2020-01-20 20:38:43 +09:00
parent aba3d66849
commit 7349f9d953
1 changed files with 9 additions and 13 deletions

View File

@ -13,21 +13,17 @@ SYMBOL: struct-return-area
SYMBOLS: int-reg-reps float-reg-reps ; SYMBOLS: int-reg-reps float-reg-reps ;
: record-reg-reps ( reps -- reps ) : record-reg-reps ( reps -- reps )
dup [ dup ! reps: { { reg-rep on-stack? odd-register? } ... }
dup second not [ ! on-stack?: f [ [ [ second not ] [ first int-rep? ] bi and ] count int-reg-reps +@ ]
first int-rep? int-reg-reps float-reg-reps ? [ [ [ second not ] [ first int-rep? not ] bi and ] count float-reg-reps +@ ]
dup get [ inc ] [ drop ] if bi ;
] [ drop ] if
] each ;
: unrecord-reg-reps ( reps -- reps ) : unrecord-reg-reps ( reps -- reps )
dup [ dup
dup second not [ ! on-stack?: f [ [ [ second not ] [ first int-rep? ] bi and ] count -1 * int-reg-reps +@ ]
first int-rep? int-reg-reps float-reg-reps ? [ [ [ second not ] [ first int-rep? not ] bi and ] count -1 * float-reg-reps +@ ]
dup get [ dec ] [ drop ] if bi ;
] [ drop ] if
] each ;
GENERIC: flatten-c-type ( c-type -- pairs ) GENERIC: flatten-c-type ( c-type -- pairs )
M: c-type flatten-c-type M: c-type flatten-c-type