windows.directx.dinput: factor out a code snippet into a word instead of repeating it many times in macro expansion, reducing compiled code size

db4
Slava Pestov 2010-05-04 04:54:48 -05:00
parent 43f7c4f2da
commit aaa4c70b01
1 changed files with 6 additions and 3 deletions

View File

@ -56,14 +56,17 @@ M: array array-base-type first ;
[ first dup word? [ '[ _ get ] ] [ drop [ f ] ] if ]
} cleave
[ DIOBJECTDATAFORMAT <struct-boa> ] dip
'[ _ clone @ >>pguid ] ;
curry ;
: set-DIOBJECTDATAFORMAT ( array struct pguid n -- array )
[ [ clone ] dip >>pguid ] dip pick set-nth ;
:: make-DIOBJECTDATAFORMAT-array-quot ( struct array -- quot )
array length '[ _ malloc-DIOBJECTDATAFORMAT-array ]
array [| args i |
struct args <DIOBJECTDATAFORMAT>-quot
i '[ _ pick set-nth ] compose compose
] each-index ;
i '[ @ _ set-DIOBJECTDATAFORMAT ]
] map-index [ ] join compose ;
>>