1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 07:09:58 +00:00

Merge pull request #514 from Interlisp/cleanup-USHORT-bitfields

Remove USHORT and direct "unsigned short" uses in struct bitfields
This commit is contained in:
Nick Briggs 2024-10-15 19:27:13 -07:00 committed by GitHub
commit 0c7b1cccd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 90 additions and 93 deletions

View File

@ -18,7 +18,7 @@
*/ */
/**********************************************************************/ /**********************************************************************/
#include "lispemul.h" /* for LispPTR, DLword */ #include "lispemul.h" /* for LispPTR, DLword */
#include "version.h" /* for USHORT */ #include "version.h" /* for BIGVM */
#define ADDREF 0 /* for gclookup routine. */ #define ADDREF 0 /* for gclookup routine. */
#define DELREF 1 /* for gclookup routine. */ #define DELREF 1 /* for gclookup routine. */
@ -131,10 +131,10 @@
#ifdef BIGVM #ifdef BIGVM
struct hashentry struct hashentry
{ /* GC hashtable entry */ { /* GC hashtable entry */
unsigned short count :15; DLword count :15;
unsigned short stackref :1; DLword stackref :1;
unsigned short segnum :15; DLword segnum :15;
unsigned short collision :1; DLword collision :1;
}; };
struct htlinkptr struct htlinkptr
@ -162,10 +162,10 @@ struct htoverflow
#else #else
struct hashentry struct hashentry
{ /* GC hashtable entry */ { /* GC hashtable entry */
USHORT count :6; DLword count :6;
USHORT stackref :1; DLword stackref :1;
USHORT segnum :8; DLword segnum :8;
USHORT collision :1; DLword collision :1;
}; };
struct htlinkptr struct htlinkptr
@ -200,10 +200,10 @@ struct htoverflow
#ifdef BIGVM #ifdef BIGVM
struct hashentry struct hashentry
{ /* GC hashtable entry */ { /* GC hashtable entry */
USHORT collision :1; DLword collision :1;
USHORT segnum :15; DLword segnum :15;
USHORT stackref :1; DLword stackref :1;
USHORT count :15; DLword count :15;
}; };
struct htlinkptr struct htlinkptr
@ -231,10 +231,10 @@ struct htoverflow
#else #else
struct hashentry struct hashentry
{ /* GC hashtable entry */ { /* GC hashtable entry */
USHORT collision :1; DLword collision :1;
USHORT segnum :8; DLword segnum :8;
USHORT stackref :1; DLword stackref :1;
USHORT count :6; DLword count :6;
}; };
struct htlinkptr struct htlinkptr

View File

@ -267,22 +267,22 @@ struct state {
/* For bit test */ /* For bit test */
typedef struct wbits { typedef struct wbits {
USHORT LSB : 1; DLword LSB : 1;
USHORT B14 : 1; DLword B14 : 1;
USHORT B13 : 1; DLword B13 : 1;
USHORT B12 : 1; DLword B12 : 1;
USHORT B11 : 1; DLword B11 : 1;
USHORT B10 : 1; DLword B10 : 1;
USHORT B9 : 1; DLword B9 : 1;
USHORT B8 : 1; DLword B8 : 1;
USHORT B7 : 1; DLword B7 : 1;
USHORT B6 : 1; DLword B6 : 1;
USHORT B5 : 1; DLword B5 : 1;
USHORT B4 : 1; DLword B4 : 1;
USHORT B3 : 1; DLword B3 : 1;
USHORT B2 : 1; DLword B2 : 1;
USHORT B1 : 1; DLword B1 : 1;
USHORT xMSB : 1; DLword xMSB : 1;
} WBITS; } WBITS;
#define PUTBASEBIT68K(base68k, offset, bitvalue) \ #define PUTBASEBIT68K(base68k, offset, bitvalue) \

View File

@ -79,22 +79,22 @@ typedef struct fnhead {
} FNHEAD; } FNHEAD;
typedef struct frameex1 { typedef struct frameex1 {
unsigned short flags : 3; DLword flags : 3;
unsigned short fast : 1; DLword fast : 1;
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ DLword nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned short incall : 1; DLword incall : 1;
unsigned short validnametable : 1; DLword validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned short nopush : 1; DLword nopush : 1;
unsigned short usecount : 8; DLword usecount : 8;
DLword alink; /* alink pointer (Low addr) */ DLword alink; /* alink pointer (Low addr) */
#ifdef BIGVM #ifdef BIGVM
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
#else #else
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ DLword hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ DLword hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
#endif /* BIGVM */ #endif /* BIGVM */
DLword nextblock; /* pointer to FreeStackBlock */ DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */ DLword pc; /* Program counter */
@ -102,23 +102,23 @@ typedef struct frameex1 {
LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */ LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */
#else #else
DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */ DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */
unsigned short hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */ DLword hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */
unsigned short hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */ DLword hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */
#endif /* BIGVM */ #endif /* BIGVM */
DLword blink; /* blink pointer (Low addr) */ DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */ DLword clink; /* clink pointer (Low addr) */
} FX; } FX;
typedef struct frameex2 { typedef struct frameex2 {
unsigned short flags : 3; DLword flags : 3;
unsigned short fast : 1; DLword fast : 1;
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ DLword nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned short incall : 1; DLword incall : 1;
unsigned short validnametable : 1; DLword validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned short nopush : 1; DLword nopush : 1;
unsigned short usecount : 8; DLword usecount : 8;
DLword alink; /* alink pointer (Low addr) */ DLword alink; /* alink pointer (Low addr) */
LispPTR fnheader; /* pointer to FunctionHeader */ LispPTR fnheader; /* pointer to FunctionHeader */
DLword nextblock; /* pointer to FreeStackBlock */ DLword nextblock; /* pointer to FreeStackBlock */
@ -135,19 +135,19 @@ typedef struct fxblock {
} FXBLOCK; } FXBLOCK;
typedef struct basic_frame { typedef struct basic_frame {
unsigned short flags : 3; DLword flags : 3;
unsigned short nil : 3; DLword nil : 3;
unsigned short residual : 1; DLword residual : 1;
unsigned short padding : 1; DLword padding : 1;
unsigned short usecnt : 8; DLword usecnt : 8;
DLword ivar; /* stk offset of IVARs for this frame ?? */ DLword ivar; /* stk offset of IVARs for this frame ?? */
} Bframe; } Bframe;
typedef struct stkword { typedef struct stkword {
unsigned short flags : 3; DLword flags : 3;
unsigned short nil : 5; DLword nil : 5;
unsigned short usecount : 8; DLword usecount : 8;
} StackWord; } StackWord;
typedef struct stack_block { typedef struct stack_block {
@ -185,33 +185,33 @@ typedef struct fnhead {
unsigned nil3 : 2; /* not used */ unsigned nil3 : 2; /* not used */
unsigned nil2 : 2; /* not used */ unsigned nil2 : 2; /* not used */
#endif /* BIGVM */ #endif /* BIGVM */
unsigned short argtype : 2; /* ?? */ DLword argtype : 2; /* ?? */
unsigned short byteswapped : 1; /* code was reswapped. */ DLword byteswapped : 1; /* code was reswapped. */
unsigned short nil4 : 1; /* not used, prev: native translated? */ DLword nil4 : 1; /* not used, prev: native translated? */
unsigned short fvaroffset : 8; DLword fvaroffset : 8;
/* DLword offset from head of NameTable */ /* DLword offset from head of NameTable */
unsigned short nlocals : 8; /* ?? */ DLword nlocals : 8; /* ?? */
DLword ntsize; /* size of NameTable */ DLword ntsize; /* size of NameTable */
/* NameTable of variable length is following with this structure. */ /* NameTable of variable length is following with this structure. */
} FNHEAD; } FNHEAD;
typedef struct frameex1 { typedef struct frameex1 {
DLword alink; /* alink pointer (Low addr) */ DLword alink; /* alink pointer (Low addr) */
unsigned short usecount : 8; DLword usecount : 8;
unsigned short nopush : 1; DLword nopush : 1;
unsigned short validnametable : 1; DLword validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned short incall : 1; DLword incall : 1;
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ DLword nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned short fast : 1; DLword fast : 1;
unsigned short flags : 3; /* hi word */ DLword flags : 3; /* hi word */
#ifdef BIGVM #ifdef BIGVM
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
#else #else
unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ DLword hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ DLword hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
#endif /* BIGVM */ #endif /* BIGVM */
@ -221,8 +221,8 @@ typedef struct frameex1 {
#ifdef BIGVM #ifdef BIGVM
LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */ LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */
#else #else
unsigned short hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */ DLword hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */
unsigned short hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */ DLword hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */
DLword lonametable; /* pointer to NameTable of this FX (Low addr) */ DLword lonametable; /* pointer to NameTable of this FX (Low addr) */
#endif /* BIGVM */ #endif /* BIGVM */
@ -232,15 +232,15 @@ typedef struct frameex1 {
typedef struct frameex2 { typedef struct frameex2 {
DLword alink; /* alink pointer (Low addr) */ DLword alink; /* alink pointer (Low addr) */
unsigned short usecount : 8; DLword usecount : 8;
unsigned short nopush : 1; DLword nopush : 1;
unsigned short validnametable : 1; DLword validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned short incall : 1; DLword incall : 1;
unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ DLword nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned short fast : 1; DLword fast : 1;
unsigned short flags : 3; DLword flags : 3;
LispPTR fnheader; /* pointer to FunctionHeader (swapped) */ LispPTR fnheader; /* pointer to FunctionHeader (swapped) */
@ -261,18 +261,18 @@ typedef struct fxblock {
typedef struct basic_frame { typedef struct basic_frame {
DLword ivar; DLword ivar;
unsigned short usecnt : 8; DLword usecnt : 8;
unsigned short padding : 1; DLword padding : 1;
unsigned short residual : 1; DLword residual : 1;
unsigned short nil : 3; DLword nil : 3;
unsigned short flags : 3; DLword flags : 3;
} Bframe; } Bframe;
typedef struct stkword { typedef struct stkword {
USHORT usecount : 8; DLword usecount : 8;
USHORT nil : 5; DLword nil : 5;
USHORT flags : 3; DLword flags : 3;
} StackWord; } StackWord;
typedef struct stack_block { typedef struct stack_block {

View File

@ -227,9 +227,6 @@ typedef unsigned char u_char;
typedef unsigned long u_int; typedef unsigned long u_int;
typedef unsigned short u_short; typedef unsigned short u_short;
#undef UNALIGNED_FETCH_OK #undef UNALIGNED_FETCH_OK
typedef unsigned USHORT;
#else
typedef unsigned short USHORT;
#endif /* DOS */ #endif /* DOS */
/****************************************************************/ /****************************************************************/