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