Skip to content

Commit 0c7b1cc

Browse files
authored
Merge pull request #514 from Interlisp/cleanup-USHORT-bitfields
Remove USHORT and direct "unsigned short" uses in struct bitfields
2 parents fae5c49 + 86ba485 commit 0c7b1cc

File tree

4 files changed

+90
-93
lines changed

4 files changed

+90
-93
lines changed

inc/gcdata.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
/**********************************************************************/
2020
#include "lispemul.h" /* for LispPTR, DLword */
21-
#include "version.h" /* for USHORT */
21+
#include "version.h" /* for BIGVM */
2222

2323
#define ADDREF 0 /* for gclookup routine. */
2424
#define DELREF 1 /* for gclookup routine. */
@@ -131,10 +131,10 @@
131131
#ifdef BIGVM
132132
struct hashentry
133133
{ /* GC hashtable entry */
134-
unsigned short count :15;
135-
unsigned short stackref :1;
136-
unsigned short segnum :15;
137-
unsigned short collision :1;
134+
DLword count :15;
135+
DLword stackref :1;
136+
DLword segnum :15;
137+
DLword collision :1;
138138
};
139139

140140
struct htlinkptr
@@ -162,10 +162,10 @@ struct htoverflow
162162
#else
163163
struct hashentry
164164
{ /* GC hashtable entry */
165-
USHORT count :6;
166-
USHORT stackref :1;
167-
USHORT segnum :8;
168-
USHORT collision :1;
165+
DLword count :6;
166+
DLword stackref :1;
167+
DLword segnum :8;
168+
DLword collision :1;
169169
};
170170

171171
struct htlinkptr
@@ -200,10 +200,10 @@ struct htoverflow
200200
#ifdef BIGVM
201201
struct hashentry
202202
{ /* GC hashtable entry */
203-
USHORT collision :1;
204-
USHORT segnum :15;
205-
USHORT stackref :1;
206-
USHORT count :15;
203+
DLword collision :1;
204+
DLword segnum :15;
205+
DLword stackref :1;
206+
DLword count :15;
207207
};
208208

209209
struct htlinkptr
@@ -231,10 +231,10 @@ struct htoverflow
231231
#else
232232
struct hashentry
233233
{ /* GC hashtable entry */
234-
USHORT collision :1;
235-
USHORT segnum :8;
236-
USHORT stackref :1;
237-
USHORT count :6;
234+
DLword collision :1;
235+
DLword segnum :8;
236+
DLword stackref :1;
237+
DLword count :6;
238238
};
239239

240240
struct htlinkptr

inc/lispemul.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,22 +267,22 @@ struct state {
267267

268268
/* For bit test */
269269
typedef struct wbits {
270-
USHORT LSB : 1;
271-
USHORT B14 : 1;
272-
USHORT B13 : 1;
273-
USHORT B12 : 1;
274-
USHORT B11 : 1;
275-
USHORT B10 : 1;
276-
USHORT B9 : 1;
277-
USHORT B8 : 1;
278-
USHORT B7 : 1;
279-
USHORT B6 : 1;
280-
USHORT B5 : 1;
281-
USHORT B4 : 1;
282-
USHORT B3 : 1;
283-
USHORT B2 : 1;
284-
USHORT B1 : 1;
285-
USHORT xMSB : 1;
270+
DLword LSB : 1;
271+
DLword B14 : 1;
272+
DLword B13 : 1;
273+
DLword B12 : 1;
274+
DLword B11 : 1;
275+
DLword B10 : 1;
276+
DLword B9 : 1;
277+
DLword B8 : 1;
278+
DLword B7 : 1;
279+
DLword B6 : 1;
280+
DLword B5 : 1;
281+
DLword B4 : 1;
282+
DLword B3 : 1;
283+
DLword B2 : 1;
284+
DLword B1 : 1;
285+
DLword xMSB : 1;
286286
} WBITS;
287287

288288
#define PUTBASEBIT68K(base68k, offset, bitvalue) \

inc/stack.h

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -79,46 +79,46 @@ typedef struct fnhead {
7979
} FNHEAD;
8080

8181
typedef struct frameex1 {
82-
unsigned short flags : 3;
83-
unsigned short fast : 1;
84-
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */
85-
unsigned short incall : 1;
86-
unsigned short validnametable : 1;
82+
DLword flags : 3;
83+
DLword fast : 1;
84+
DLword nil2 : 1; /* not used, prev: This frame treats N-func */
85+
DLword incall : 1;
86+
DLword validnametable : 1;
8787
/* 0: look for FunctionHeader
8888
1: look for NameTable on this FrameEx */
89-
unsigned short nopush : 1;
90-
unsigned short usecount : 8;
89+
DLword nopush : 1;
90+
DLword usecount : 8;
9191
DLword alink; /* alink pointer (Low addr) */
9292
#ifdef BIGVM
9393
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
9494
#else
9595
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
96-
unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
97-
unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
96+
DLword hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
97+
DLword hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
9898
#endif /* BIGVM */
9999
DLword nextblock; /* pointer to FreeStackBlock */
100100
DLword pc; /* Program counter */
101101
#ifdef BIGVM
102102
LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */
103103
#else
104104
DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */
105-
unsigned short hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */
106-
unsigned short hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */
105+
DLword hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */
106+
DLword hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */
107107
#endif /* BIGVM */
108108
DLword blink; /* blink pointer (Low addr) */
109109
DLword clink; /* clink pointer (Low addr) */
110110
} FX;
111111

112112
typedef struct frameex2 {
113-
unsigned short flags : 3;
114-
unsigned short fast : 1;
115-
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */
116-
unsigned short incall : 1;
117-
unsigned short validnametable : 1;
113+
DLword flags : 3;
114+
DLword fast : 1;
115+
DLword nil2 : 1; /* not used, prev: This frame treats N-func */
116+
DLword incall : 1;
117+
DLword validnametable : 1;
118118
/* 0: look for FunctionHeader
119119
1: look for NameTable on this FrameEx */
120-
unsigned short nopush : 1;
121-
unsigned short usecount : 8;
120+
DLword nopush : 1;
121+
DLword usecount : 8;
122122
DLword alink; /* alink pointer (Low addr) */
123123
LispPTR fnheader; /* pointer to FunctionHeader */
124124
DLword nextblock; /* pointer to FreeStackBlock */
@@ -135,19 +135,19 @@ typedef struct fxblock {
135135
} FXBLOCK;
136136

137137
typedef struct basic_frame {
138-
unsigned short flags : 3;
139-
unsigned short nil : 3;
140-
unsigned short residual : 1;
141-
unsigned short padding : 1;
142-
unsigned short usecnt : 8;
138+
DLword flags : 3;
139+
DLword nil : 3;
140+
DLword residual : 1;
141+
DLword padding : 1;
142+
DLword usecnt : 8;
143143
DLword ivar; /* stk offset of IVARs for this frame ?? */
144144

145145
} Bframe;
146146

147147
typedef struct stkword {
148-
unsigned short flags : 3;
149-
unsigned short nil : 5;
150-
unsigned short usecount : 8;
148+
DLword flags : 3;
149+
DLword nil : 5;
150+
DLword usecount : 8;
151151
} StackWord;
152152

153153
typedef struct stack_block {
@@ -185,33 +185,33 @@ typedef struct fnhead {
185185
unsigned nil3 : 2; /* not used */
186186
unsigned nil2 : 2; /* not used */
187187
#endif /* BIGVM */
188-
unsigned short argtype : 2; /* ?? */
189-
unsigned short byteswapped : 1; /* code was reswapped. */
190-
unsigned short nil4 : 1; /* not used, prev: native translated? */
191-
unsigned short fvaroffset : 8;
188+
DLword argtype : 2; /* ?? */
189+
DLword byteswapped : 1; /* code was reswapped. */
190+
DLword nil4 : 1; /* not used, prev: native translated? */
191+
DLword fvaroffset : 8;
192192
/* DLword offset from head of NameTable */
193-
unsigned short nlocals : 8; /* ?? */
193+
DLword nlocals : 8; /* ?? */
194194
DLword ntsize; /* size of NameTable */
195195
/* NameTable of variable length is following with this structure. */
196196
} FNHEAD;
197197

198198
typedef struct frameex1 {
199199
DLword alink; /* alink pointer (Low addr) */
200-
unsigned short usecount : 8;
201-
unsigned short nopush : 1;
202-
unsigned short validnametable : 1;
200+
DLword usecount : 8;
201+
DLword nopush : 1;
202+
DLword validnametable : 1;
203203
/* 0: look for FunctionHeader
204204
1: look for NameTable on this FrameEx */
205-
unsigned short incall : 1;
206-
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */
207-
unsigned short fast : 1;
208-
unsigned short flags : 3; /* hi word */
205+
DLword incall : 1;
206+
DLword nil2 : 1; /* not used, prev: This frame treats N-func */
207+
DLword fast : 1;
208+
DLword flags : 3; /* hi word */
209209

210210
#ifdef BIGVM
211211
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
212212
#else
213-
unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
214-
unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
213+
DLword hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
214+
DLword hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
215215
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
216216
#endif /* BIGVM */
217217

@@ -221,8 +221,8 @@ typedef struct frameex1 {
221221
#ifdef BIGVM
222222
LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */
223223
#else
224-
unsigned short hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */
225-
unsigned short hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */
224+
DLword hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */
225+
DLword hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */
226226
DLword lonametable; /* pointer to NameTable of this FX (Low addr) */
227227
#endif /* BIGVM */
228228

@@ -232,15 +232,15 @@ typedef struct frameex1 {
232232

233233
typedef struct frameex2 {
234234
DLword alink; /* alink pointer (Low addr) */
235-
unsigned short usecount : 8;
236-
unsigned short nopush : 1;
237-
unsigned short validnametable : 1;
235+
DLword usecount : 8;
236+
DLword nopush : 1;
237+
DLword validnametable : 1;
238238
/* 0: look for FunctionHeader
239239
1: look for NameTable on this FrameEx */
240-
unsigned short incall : 1;
241-
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */
242-
unsigned short fast : 1;
243-
unsigned short flags : 3;
240+
DLword incall : 1;
241+
DLword nil2 : 1; /* not used, prev: This frame treats N-func */
242+
DLword fast : 1;
243+
DLword flags : 3;
244244

245245
LispPTR fnheader; /* pointer to FunctionHeader (swapped) */
246246

@@ -261,18 +261,18 @@ typedef struct fxblock {
261261

262262
typedef struct basic_frame {
263263
DLword ivar;
264-
unsigned short usecnt : 8;
265-
unsigned short padding : 1;
266-
unsigned short residual : 1;
267-
unsigned short nil : 3;
268-
unsigned short flags : 3;
264+
DLword usecnt : 8;
265+
DLword padding : 1;
266+
DLword residual : 1;
267+
DLword nil : 3;
268+
DLword flags : 3;
269269

270270
} Bframe;
271271

272272
typedef struct stkword {
273-
USHORT usecount : 8;
274-
USHORT nil : 5;
275-
USHORT flags : 3;
273+
DLword usecount : 8;
274+
DLword nil : 5;
275+
DLword flags : 3;
276276
} StackWord;
277277

278278
typedef struct stack_block {

inc/version.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ typedef unsigned char u_char;
227227
typedef unsigned long u_int;
228228
typedef unsigned short u_short;
229229
#undef UNALIGNED_FETCH_OK
230-
typedef unsigned USHORT;
231-
#else
232-
typedef unsigned short USHORT;
233230
#endif /* DOS */
234231

235232
/****************************************************************/

0 commit comments

Comments
 (0)