Skip to content

Commit 7afbab9

Browse files
authored
Merge pull request #32 from codereport/remove-be
Removing C_LE (Big Endian support)
2 parents 416fab3 + e537f0d commit 7afbab9

File tree

19 files changed

+32
-158
lines changed

19 files changed

+32
-158
lines changed

jsrc/ar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,13 @@ static DF1(jtreducesp){A a,g,z;B b;I f,n,r,*v,wn,wr,*ws,wt,zt;P*wp;
435435
else DQ(m, x=*u++; y=*u++; *zv++=F(x,y); ); \
436436
}
437437
#define BTABIFX(F) {btab[0 ]=0 F 0; \
438-
btab[C_LE?256: 1]=0 F 1; \
439-
btab[C_LE? 1:256]=1 F 0; \
438+
btab[256]=0 F 1; \
439+
btab[ 1]=1 F 0; \
440440
btab[257 ]=1 F 1; \
441441
}
442442
#define BTABPFX(F) {btab[0 ]=F(0,0); \
443-
btab[C_LE?256: 1]=F(0,1); \
444-
btab[C_LE? 1:256]=F(1,0); \
443+
btab[256]=F(0,1); \
444+
btab[ 1]=F(1,0); \
445445
btab[257 ]=F(1,1); \
446446
}
447447
#define BR2CASE(t,id) ((id)+256*(t))

jsrc/dtoa.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@
169169
/* Options for use with J */
170170
#include "js.h"
171171
#define Long int
172-
#if C_LE
173172
#define IEEE_8087
174-
#else
175-
#define IEEE_MC68k
176-
#endif
177173
#define MULTIPLE_THREADS
178174
#define ACQUIRE_DTOA_LOCK(n) /* handled by using jt */
179175
#define FREE_DTOA_LOCK(n) /* handled by using jt */

jsrc/j.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,10 @@ static inline omp_int_t omp_get_max_threads() { return 1;}
271271
#define XNAN "\000\000\000\000\000\000\370\177"
272272
#endif
273273

274-
#if C_LE
275274
#ifndef XINF
276275
#define XINF "\000\000\000\000\000\000\360\177"
277276
#define XNAN "\000\000\000\000\000\000\370\377"
278277
#endif
279-
#endif
280278

281279
#ifndef XINF
282280
#define XINF "\177\360\000\000\000\000\000\000"
@@ -921,15 +919,10 @@ static inline __attribute__((inline)) float64x2_t vec_and_pd(float64x2_t a, floa
921919
#define NUMMAX 9 // largest number represented in num[]
922920
#define NUMMIN (~NUMMAX) // smallest number represented in num[]
923921
// Given SZI B01s read into p, pack the bits into the MSBs of p and clear the lower bits of p
924-
#if C_LE // if anybody makes a bigendian CPU we'll have to recode
925922
#if BW==64
926923
// this is what it should be #define PACKBITS(p) {p|=p>>7LL;p|=p>>14LL;p|=p>>28LL;p<<=56LL;}
927924
#define PACKBITS(p) {p|=p>>7LL;p|=p>>14LL;p|=p<<28LL;p&=0xff0000000; p<<=28LL;} // this generates one extra instruction, rather than the 3 for the correct version
928925
#define PACKBITSINTO(p,out) {p|=p>>7LL;p|=p>>14LL;out=((p|(p>>28LL))<<56)|(out>>SZI);} // pack and shift into out
929-
#else
930-
#define PACKBITS(p) {p|=p>>7LL;p|=p>>14LL;p<<=28LL;}
931-
#define PACKBITSINTO(p,out) {p|=p>>7LL;p|=p>>14LL;out=(p<<28)|(out>>SZI);} // pack and shift into out
932-
#endif
933926
#endif
934927
#define PRISTCOMSET(w,flg) awback=(w); if(unlikely((flg&AFVIRTUAL)!=0)){awback=ABACK(awback); flg=AFLAG(awback);} AFLAG(awback)=flg&~AFPRISTINE;
935928
#define PRISTCOMSETF(w,flg) if(unlikely((flg&AFVIRTUAL)!=0)){w=ABACK(w); flg=AFLAG(w);} AFLAG(w)=flg&~AFPRISTINE; // used only at end, when w can be destroyed
@@ -1057,10 +1050,8 @@ if(likely(z<3)){_zzt+=z; z=(I)&oneone; _zzt=_i&3?_zzt:(I*)z; z=_i&2?(I)_zzt:z; z
10571050
#else
10581051
#define REPLBYTETOW(in,out) (out=(UC)(in),out|=out<<8,out|=out<<16)
10591052
#endif
1060-
#if C_LE
10611053
// Output is pointer, Input is I/UI, count is # bytes to NOT store to output pointer (0-7).
10621054
#define STOREBYTES(out,in,n) {*(UI*)(out) = (*(UI*)(out)&~((UI)~(I)0 >> ((n)<<3))) | ((in)&((UI)~(I)0 >> ((n)<<3)));}
1063-
#endif
10641055
// Input is the name of word of bytes. Result is modified name, 1 bit per input byte, spaced like B01s, with the bit 0 iff the corresponding input byte was all 0. Non-boolean bits of result are garbage.
10651056
#define ZBYTESTOZBITS(b) (b=b|((b|(~b+VALIDBOOLEAN))>>7)) // for each byte: zero if b0 off, b7 off, and b7 turns on when you subtract 1 or 2
10661057
// to verify gah conversion #define RETF(exp) { A retfff=(exp); if ((retfff) && ((AT(retfff)&SPARSE && AN(retfff)!=1) || (AT(retfff)&DENSE && AN(retfff)!=prod(AR(retfff),AS(retfff)))))SEGFAULT;; R retfff; } // scaf
@@ -1099,7 +1090,6 @@ if(likely(z<3)){_zzt+=z; z=(I)&oneone; _zzt=_i&3?_zzt:(I*)z; z=_i&2?(I)_zzt:z; z
10991090
#define VAL2 '\002'
11001091
#define WITHDEBUGOFF(stmt) {UC d=jt->uflags.us.cx.cx_c.db; jt->uflags.us.cx.cx_c.db=0; stmt jt->uflags.us.cx.cx_c.db=d;} // execute stmt with debug turned off
11011092

1102-
#if C_LE
11031093
#if BW==64
11041094
#define IHALF0 0x00000000ffffffffLL
11051095
#else
@@ -1125,39 +1115,9 @@ if(likely(z<3)){_zzt+=z; z=(I)&oneone; _zzt=_i&3?_zzt:(I*)z; z=_i&2?(I)_zzt:z; z
11251115
#define BS01 0x0100
11261116
#define BS10 0x0001
11271117
#define BS11 0x0101
1128-
#else
1129-
#if BW==64
1130-
#define IHALF0 0xffffffff00000000LL
1131-
#else
1132-
#define IHALF0 0xffff0000
1133-
#endif
1134-
#define B0000 0x00000000
1135-
#define B0001 0x00000001
1136-
#define B0010 0x00000100
1137-
#define B0011 0x00000101
1138-
#define B0100 0x00010000
1139-
#define B0101 0x00010001
1140-
#define B0110 0x00010100
1141-
#define B0111 0x00010101
1142-
#define B1000 0x01000000
1143-
#define B1001 0x01000001
1144-
#define B1010 0x01000100
1145-
#define B1011 0x01000101
1146-
#define B1100 0x01010000
1147-
#define B1101 0x01010001
1148-
#define B1110 0x01010100
1149-
#define B1111 0x01010101
1150-
#define BS00 0x0000
1151-
#define BS01 0x0001
1152-
#define BS10 0x0100
1153-
#define BS11 0x0101
1154-
#endif
1155-
1156-
11571118

11581119
#define CACHELINESIZE 64 // size of processor cache line, in case we align to it
11591120

1160-
11611121
// flags in call to cachedmmult and blockedmmult
11621122
#define FLGCMPX 0
11631123
#define FLGCMP ((I)1<<FLGCMPX) // arguments are complex

jsrc/js.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
/* */
44
/* SYS_ and friends */
55

6-
// configuration - conditional compilation
7-
// historical confusion that will slowly be sorted out
8-
// complexity of autoconf et. al. seems overkill for J - we shall see
9-
10-
// C_? new style config - default value if not defined by builder
11-
12-
#ifndef C_LE // littleendian/bigendian
13-
#define C_LE 1
14-
#endif
15-
166
#ifndef C_NA // noasm/asm
177
#define C_NA 1
188
#endif

jsrc/jtype.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,10 @@ struct AD {
116116
I c; // usecount
117117
// NOTE!! result.h faux cellshape block depends on n, r, and s being in place from here to the end of this struct, with 2 Is from n to s
118118
I n; // # atoms - always 1 for sparse arrays
119-
#if C_LE
120119
RANKT r; // rank
121120
US h; // reserved for allocator. Not used for AFNJA memory
122121
#if BW==64
123122
UI4 fill; // On 64-bit systems, there will be a padding word here - insert in case compiler doesn't
124-
#endif
125-
#else
126-
#if BW==64
127-
UI4 fill; // On 64-bit systems, there will be a padding word here - insert in case compiler doesn't
128-
#endif
129-
US h; // reserved for allocator. Not used for AFNJA memory
130-
RANKT r; // rank
131123
#endif
132124
I s[1]; // shape starts here. NOTE!! s[0] is always OK to fetch. We allocate 8 words minimum and s[0] is the last.
133125
};
@@ -210,10 +202,7 @@ typedef I SI;
210202
#define PAV(x) ( (P*)((C*)(x)+AK(x))) /* sparse */
211203
#define SBAV(x) ((SB*)((C*)(x)+AK(x))) /* symbol */
212204
#define voidAV(x) ((void*)((C*)(x)+AK(x))) // unknown
213-
214-
#if C_LE
215205
#define BIV0(w) (IAV(w)[0]&(1-((AT(w)&INT)>>(INTX-1)))) // the first (presumably only) value in w, when w is an INT or B01 type
216-
#endif
217206

218207
/* Types for AT(x) field of type A */
219208
/* Note: BOOL name conflict with ???; SCHAR name conflict with sqltypes.h */

jsrc/k.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static KF1(jtQfromX){X*v=XAV(w),*x=(X*)yv; DQ(AN(w), *x++=*v++; *x++=iv1;); R 1;
158158

159159
static KF2(jtQfromD){B neg,recip;D c,d,t,*wv;I e,i,n,*v;Q q,*x;S*tv;
160160
if(!(w))R 0;
161-
n=AN(w); wv=DAV(w); x=(Q*)yv; tv=3*C_LE+(S*)&t;
161+
n=AN(w); wv=DAV(w); x=(Q*)yv; tv=3+(S*)&t;
162162
for(i=0;i<n;++i){
163163
t=wv[i];
164164
ASSERT(!_isnan(t),EVNAN);

jsrc/sl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ A jtstfindcre(J jt,I n,C*u,I bucketx){
200200
// b is flags: 1=check name for validity, 2=do not allow numeric locales (whether atomic or not)
201201
static A jtvlocnl(J jt,I b,A w){A*wv,y;C*s;I i,m,n;
202202
ARGCHK1(w);
203-
if(((b-2) & (SGNIF(AT(w),INTX) | (SGNIF(AT(w),B01X) & (AR(w)-1))))<0)R w; // integer list or scalar boolean is OK C_LE
203+
if(((b-2) & (SGNIF(AT(w),INTX) | (SGNIF(AT(w),B01X) & (AR(w)-1))))<0)R w; // integer list or scalar boolean is OK
204204
n=AN(w);
205205
ASSERT(((n-1)|SGNIF(AT(w),BOXX))<0,EVDOMAIN);
206206
wv=AAV(w);

jsrc/va2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ DF2(jtfslashatg){A fs,gs,y,z;B b,sb=0;C*av,c,d,*wv;I ak,an,ar,*as,at,m,
10021002
tn=(zn+SZI-1)>>LGSZI; GATV0(t,INT,tn,1); tc=UAV(t); ti=(UI*)tc;
10031003
// Run g in batches of up to 255, accumulating the result bytewise. NOTE: there may be garbage at the end of yv, but because
10041004
// we are supporting littleendian only, it will not affect the result
1005-
for(j=nn;0<j;j-=255/C_LE){
1005+
for(j=nn;0<j;j-=255){
10061006
memset(ti,C0,tn*SZI);
10071007
DO(MIN(j,255), ((AHDR2FN*)adocv.f)(n,m,av,wv,yv,jt); av+=ak; wv+=wk; DO(tn,ti[i]+=yv[i];););
10081008
DO(zn, zv[i]+=tc[i];);

jsrc/vcompsc.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,25 @@
109109
R sc(n); \
110110
}
111111

112-
#define SUMB(f,T0,T1,F) \
113-
static F2(f){I an,*av,n,p,r1,wn,*wv,z=0;UI t,x; \
114-
an=AN(a); av=AV(a); \
115-
wn=AN(w); wv=AV(w); n=1; n=AR(a)?an:n; n=AR(w)?wn:n; \
116-
p=n>>LGSZI; r1=n&(SZI-1); \
117-
if (!AR(a)){ \
118-
ASSIGNX(av); \
112+
#define SUMB(f,T0,T1,F) \
113+
static F2(f){I an,*av,n,p,r1,wn,*wv,z=0;UI t,x; \
114+
an=AN(a); av=AV(a); \
115+
wn=AN(w); wv=AV(w); n=1; n=AR(a)?an:n; n=AR(w)?wn:n; \
116+
p=n>>LGSZI; r1=n&(SZI-1); \
117+
if (!AR(a)){ \
118+
ASSIGNX(av); \
119119
while((p-=255)>0){t=0; DQ(255, t+=F(x, *wv++);); ADDBYTESINI(t); z+=t;} \
120-
t=0; DQ(p+255, t+=F(x, *wv++);); ADDBYTESINI(t); z+=t; x=F(x, *wv); \
121-
}else if(!AR(w)){ \
122-
ASSIGNX(wv); \
120+
t=0; DQ(p+255, t+=F(x, *wv++);); ADDBYTESINI(t); z+=t; x=F(x, *wv); \
121+
}else if(!AR(w)){ \
122+
ASSIGNX(wv); \
123123
while((p-=255)>0){t=0; DQ(255, t+=F(*av++,x );); ADDBYTESINI(t); z+=t;} \
124-
t=0; DQ(p+255, t+=F(*av++,x );); ADDBYTESINI(t); z+=t; x=F(*av,x ); \
125-
}else{ \
124+
t=0; DQ(p+255, t+=F(*av++,x );); ADDBYTESINI(t); z+=t; x=F(*av,x ); \
125+
}else{ \
126126
while((p-=255)>0){t=0; DQ(255, t+=F(*av++,*wv++);); ADDBYTESINI(t); z+=t;} \
127-
t=0; DQ(p+255, t+=F(*av++,*wv++);); ADDBYTESINI(t); z+=t; x=F(*av,*wv); \
128-
} \
129-
x &= ((I)1<<(r1<<LGBB))-1; ADDBYTESINI(x); z+=x; /* C_LE */ \
130-
R sc(z); \
127+
t=0; DQ(p+255, t+=F(*av++,*wv++);); ADDBYTESINI(t); z+=t; x=F(*av,*wv); \
128+
} \
129+
x &= ((I)1<<(r1<<LGBB))-1; ADDBYTESINI(x); z+=x; \
130+
R sc(z); \
131131
}
132132

133133
INDB( i0eqBB,B,B,NE ) INDF( i0eqBI,B,I,ANE ) INDF0( i0eqBD,B,D,TNEXD,NEXD0) /* = */

jsrc/ve.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ A jtintmod2(J jt,A w,I mod){A z;B *v;I n,q,r,*u;UI m=0; // init m for warning
442442
// the rest is boolean result
443443
n=AN(w); v=BAV(w); // littleendian only
444444
GATV(z,B01,n,AR(w),AS(w)); RZ(n); // loops below can't handle empty
445-
u=AV(z); q=(n-1)>>(LGSZI/C_LE); r=((n-1)&(SZI-1))+1; // there is always a remnant
445+
u=AV(z); q=(n-1)>>(LGSZI); r=((n-1)&(SZI-1))+1; // there is always a remnant
446446
I mask=mod==2?VALIDBOOLEAN:0; // if mod is 1, all results will be 0; otherwise boolean result
447447
DQ(q, DQ(SZI, m=(m>>8)+((UI)*v<<((SZI-1)*8)); v+=SZI;); *u++=m&mask;)
448448
DQ(r, m=(m>>8)+((UI)*v<<((SZI-1)*8)); v+=SZI;); // 1-8 bytes

0 commit comments

Comments
 (0)