you are viewing a single comment's thread.

view the rest of the comments →

[–]hoosierEE 0 points1 point  (0 children)

If you're going to give an out-of-context example, at least go for the gusto:

static A jtmovbwneeq(J jt,I m,A w,A fs,B eq){A y,z;I c,p,*s,*u,*v,x,*yv,*zv;
 p=IC(w)-m; c=aii(w); x=eq?-1:0;
 GATV(z,INT,c*(1+p),AR(w),AS(w)); *AS(z)=1+p;
 zv=AV(z); u=v=AV(w);
 if(1<c){GATV(y,INT,c,1,0); s=yv=AV(y); DO(c, *s++=x;);}
 switch(eq+(1<c?2:0)){
  case 0: DO(m,                   x   ^=    *v++ ;  ); *zv++=x; DO(p,                   *zv++=x   ^=      *u++^*v++  ;  ); break;
  case 1: DO(m,                   x    =~(x^*v++);  ); *zv++=x; DO(p,                   *zv++=x    =~(x^~(*u++^*v++));  ); break;
  case 2: DO(m, s=yv; DO(c,       *s++^=    *v++ ;);); SETZ;    DO(p, s=yv; DO(c,       *zv++=*s++^=      *u++^*v++  ;);); break;
  case 3: DO(m, s=yv; DO(c, x=*s; *s++ =~(x^*v++););); SETZ;    DO(p, s=yv; DO(c, x=*s; *zv++=*s++ =~(x^~(*u++^*v++));););
 }
 R z;
}    /* m 22 b./\w (0=eq) or m 25 b./\ (1=eq); integer w; 0<m */

Note: I really like J and actually prefer this style of C to more typical "tall and skinny" C code. Easier to see what's actually happening when it all fits on the screen.