From ac83fe3815b652fd202b6b53cf15607eacbc88ab Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 5 Mar 1991 13:06:00 +0000 Subject: [PATCH] Removed WORDLENGTH generation program; no longer assume that the machine on which we compile is the machine on which we run --- util/ego/share/.distr | 1 - util/ego/share/Makefile | 13 +++---------- util/ego/share/global.h | 28 ++++++++++++---------------- util/ego/share/show.c | 2 +- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/util/ego/share/.distr b/util/ego/share/.distr index 935f7fc9b..402b43da7 100644 --- a/util/ego/share/.distr +++ b/util/ego/share/.distr @@ -25,7 +25,6 @@ lset.c lset.h makecldef.c makedepend -makewlen.c map.c map.h parser.c diff --git a/util/ego/share/Makefile b/util/ego/share/Makefile index 42861cd24..476fca576 100644 --- a/util/ego/share/Makefile +++ b/util/ego/share/Makefile @@ -22,7 +22,7 @@ PRFILES=$(SRC) $(CC) -c.m $(CFLAGS) $< all:\ -classdefs.h pop_push.h wordlen.h alloc.o cset.o debug.o files.o go.o\ +classdefs.h pop_push.h alloc.o cset.o debug.o files.o go.o\ global.o lset.o map.o parser.o get.o put.o aux.o stack_chg.o locals.o\ init_glob.o @@ -33,7 +33,7 @@ cmp: all distr: pop_push.h em_files:\ -classdefs.h pop_push.h wordlen.h alloc.m cset.m debug.m\ +classdefs.h pop_push.h alloc.m cset.m debug.m\ files.m go.m global.m lset.m map.m parser.m get.m put.m aux.m stack_chg.m\ locals.m init_glob.m @@ -50,13 +50,6 @@ pop_push.h: \ $(EMHOME)/etc/em_table pop_push.awk awk -f pop_push.awk < $(EMHOME)/etc/em_table > pop_push.h -wordlen.h: makewordlen - makewordlen > wordlen.h - rm makewordlen - -makewordlen: makewlen.c - $(CC) -o makewordlen makewlen.c - show: \ show.c $(CC) -o show show.c $(EMLIB)/em_data.a @@ -73,7 +66,7 @@ clean: @echo "cleaned. Type 'make oclean' instead." oclean: - rm -f makeclassdef classdefs.h makewordlen wordlen.h *.o Out out nohup.out *.m + rm -f makeclassdef classdefs.h *.o Out out nohup.out *.m lint: lint $(LINTFLAGS) $(CPPFLAGS) $(CFILES) diff --git a/util/ego/share/global.h b/util/ego/share/global.h index a46831b16..fcb02c212 100644 --- a/util/ego/share/global.h +++ b/util/ego/share/global.h @@ -17,9 +17,6 @@ extern int ws; /* word size */ /* number of bits in a byte */ #define BYTELENGTH 8 -/* number of bits in a word, defined in automatically generated file */ -#include "../share/wordlen.h" - #if BYTELENGTH==8 #define DIVBL(a) ((a) >> 3) #define MODBL(a) ((a) & 07) @@ -28,19 +25,18 @@ extern int ws; /* word size */ #define MODBL(a) (a%BYTELENGTH) #endif -#if WORDLENGTH==16 -#define DIVWL(a) ((a) >> 4) -#define MODWL(a) ((a) & 017) -#else -#if WORDLENGTH==32 -#define DIVWL(a) ((a) >> 5) -#define MODWL(a) ((a) & 037) -#else -#define DIVWL(a) (a/WORDLENGTH) -#define MODWL(a) (a%WORDLENGTH) -#endif -#endif - +#define WORDLENGTH (sizeof(int)*BYTELENGTH) + +#define DIVWL(a) (WORDLENGTH==16 ? \ + ((a)>>4) : \ + (WORDLENGTH==32 ? \ + ((a)>>5) : \ + ((a)/(8*sizeof(int))))) +#define MODWL(a) (WORDLENGTH==16 ? \ + ((a)&017) : \ + (WORDLENGTH==32 ? \ + ((a)&037) : \ + ((a)%(8*sizeof(int))))) #define UNKNOWN_SIZE (-1) diff --git a/util/ego/share/show.c b/util/ego/share/show.c index 3da9d6002..dcd526f60 100644 --- a/util/ego/share/show.c +++ b/util/ego/share/show.c @@ -143,7 +143,7 @@ showcset() for (;;) { w = getint(); mask = 1 ; - for (j = 1; j <= WORDLENGTH; j++) { + for (j = 1; j <= sizeof(int)*8; j++) { if (w & mask) { printf("%d ",i); } -- 2.34.1