Skip to content

Commit 931ede9

Browse files
committed
32-bit I.@e.
1 parent fbc4b24 commit 931ede9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

jsrc/vi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,13 @@ A jtindexofsub(J jt,I mode,A a,A w){PROLOG(0079);A h=0,hi=mtv,z;B mk=w==mark,th;
13311331
}
13321332
xv[0]=mode; xv[1]=n; xv[2]=k; xv[3]=jt->min; xv[4]=(I)fn; xv[5]=ztype;
13331333
zv[0]=incorp(x); zv[1]=incorp(h); zv[2]=incorp(hi);
1334+
}else if(unlikely((mode&IIOPMSK)==IIFBEPS)){
1335+
// I.@e. initially allocated a maximum-sized result, which might be colossally wasteful of space (but not of time or cache footprint)
1336+
// if the block is mostly empty, reallocate it & copy a right-sized block
1337+
if(((allosize(z)-AKXR(1))>>(LGSZI+1))>MAX(AN(z),12)){ // if a smaller block would serve (but not if the block is already small)
1338+
GATV0(h,INT,AN(z),1); JMC(IAV1(h),IAV1(z),SZI*AN(z),0) z=h; // repackage the result in a right-sized block
13341339
}
1340+
}
13351341
} // end of 'not sequential comparison' which means we need a hashtable
13361342
RZ(z=EPILOGNORET(z));
13371343
// Since EPILOG may have rewritten AM, and IFORKEY never returns to the parser, we can store the FORKEY result in AM.

test/gibs.ijs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ x test y [ x=: 811 0$a: [ y=: 947 0$a:
9595
y test y
9696

9797
(600 ?@$ 1000) (I.@e. -: I.@(e."e.)) 465 ?@$ 1000
98-
(7!:2 'a I.@e. i. 4') > 2 * (7!:2 'a I.@(e."e.) i. 4') [ a =. i. 1000
98+
(7!:2 'a I.@e. i. 4') > 2 * (7!:2 'a I.@(e."e.) i. 4') [ a =: i. 2000
9999

100100
4!:55 ;:'a b f f1 g mean q r test u x y'
101101

0 commit comments

Comments
 (0)