From aaa4c70b0167b8d9010662bd4a61e92f992bbf4a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 4 May 2010 04:54:48 -0500 Subject: [PATCH] windows.directx.dinput: factor out a code snippet into a word instead of repeating it many times in macro expansion, reducing compiled code size --- basis/windows/directx/dinput/constants/constants.factor | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/basis/windows/directx/dinput/constants/constants.factor b/basis/windows/directx/dinput/constants/constants.factor index 98ea261d38..c77364ccde 100755 --- a/basis/windows/directx/dinput/constants/constants.factor +++ b/basis/windows/directx/dinput/constants/constants.factor @@ -56,14 +56,17 @@ M: array array-base-type first ; [ first dup word? [ '[ _ get ] ] [ drop [ f ] ] if ] } cleave [ DIOBJECTDATAFORMAT ] 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 -quot - i '[ _ pick set-nth ] compose compose - ] each-index ; + i '[ @ _ set-DIOBJECTDATAFORMAT ] + ] map-index [ ] join compose ; >> -- 2.34.1