Removed WORDLENGTH generation program; no longer assume that the machine
authorceriel <none@none>
Tue, 5 Mar 1991 13:06:00 +0000 (13:06 +0000)
committerceriel <none@none>
Tue, 5 Mar 1991 13:06:00 +0000 (13:06 +0000)
on which we compile is the machine on which we run

util/ego/share/.distr
util/ego/share/Makefile
util/ego/share/global.h
util/ego/share/show.c

index 935f7fc..402b43d 100644 (file)
@@ -25,7 +25,6 @@ lset.c
 lset.h
 makecldef.c
 makedepend
-makewlen.c
 map.c
 map.h
 parser.c
index 42861cd..476fca5 100644 (file)
@@ -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)
index a46831b..fcb02c2 100644 (file)
@@ -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)
 
index 3da9d60..dcd526f 100644 (file)
@@ -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);
                        }