top: why not maximize usage of some manifest constants
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
7fede95f8a
commit
8502c49619
@ -2307,8 +2307,8 @@ static void fields_utility (void) {
|
|||||||
#endif
|
#endif
|
||||||
#define swapEM { int c; unSCRL; c = w->rc.fieldscur[i]; \
|
#define swapEM { int c; unSCRL; c = w->rc.fieldscur[i]; \
|
||||||
w->rc.fieldscur[i] = *p; *p = c; p = &w->rc.fieldscur[i]; }
|
w->rc.fieldscur[i] = *p; *p = c; p = &w->rc.fieldscur[i]; }
|
||||||
#define spewFI { int *t; f = w->rc.sortindx; t = msch(w->rc.fieldscur, ENUcvt(f, ENUon), EU_MAXPFLGS); \
|
#define spewFI { int *t; f = w->rc.sortindx; t = msch(w->rc.fieldscur, ENUcvt(f, FLDon), EU_MAXPFLGS); \
|
||||||
if (!t) t = msch(w->rc.fieldscur, ENUcvt(f, ENUoff), EU_MAXPFLGS); \
|
if (!t) t = msch(w->rc.fieldscur, ENUcvt(f, FLDoff), EU_MAXPFLGS); \
|
||||||
i = (t) ? (int)(t - w->rc.fieldscur) : 0; }
|
i = (t) ? (int)(t - w->rc.fieldscur) : 0; }
|
||||||
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
||||||
const char *h = NULL;
|
const char *h = NULL;
|
||||||
@ -3666,7 +3666,7 @@ static int cfg_xform (WIN_t *q, char *flds, const char *defs) {
|
|||||||
for (i = 0; i < x; i++) {
|
for (i = 0; i < x; i++) {
|
||||||
f = ((unsigned char)flds[i] & 0x7f);
|
f = ((unsigned char)flds[i] & 0x7f);
|
||||||
f = f << 1;
|
f = f << 1;
|
||||||
if ((unsigned char)flds[i] & 0x80) f |= 0x01;
|
if ((unsigned char)flds[i] & 0x80) f |= FLDon;
|
||||||
*(pn + i) = f;
|
*(pn + i) = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
top/top.h
10
top/top.h
@ -399,14 +399,14 @@ typedef struct WIN_t {
|
|||||||
#define VIZTOGw(q,f) (VIZISw(q)) ? TOGw(q,(f)) : win_warn(Warn_VIZ)
|
#define VIZTOGw(q,f) (VIZISw(q)) ? TOGw(q,(f)) : win_warn(Warn_VIZ)
|
||||||
|
|
||||||
// Used to test/manipulte fieldscur values
|
// Used to test/manipulte fieldscur values
|
||||||
|
#define FLDon 0x01
|
||||||
|
#define FLDoff 0x00
|
||||||
#define FLDget(q,i) ( (((q)->rc.fieldscur[i]) >> 1) - FLD_OFFSET )
|
#define FLDget(q,i) ( (((q)->rc.fieldscur[i]) >> 1) - FLD_OFFSET )
|
||||||
#define FLDtog(q,i) ( (q)->rc.fieldscur[i] ^= 0x01 )
|
#define FLDtog(q,i) ( (q)->rc.fieldscur[i] ^= FLDon )
|
||||||
#define FLDviz(q,i) ( (q)->rc.fieldscur[i] & 0x01 )
|
#define FLDviz(q,i) ( (q)->rc.fieldscur[i] & FLDon )
|
||||||
#define ENUviz(w,E) ( NULL != msch((w)->procflgs, E, w->maxpflgs) )
|
#define ENUviz(w,E) ( NULL != msch((w)->procflgs, E, w->maxpflgs) )
|
||||||
#define ENUpos(w,E) ( (int)(msch((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall) )
|
#define ENUpos(w,E) ( (int)(msch((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall) )
|
||||||
#define ENUcvt(E,x) ( (int)(((E + FLD_OFFSET) << 1) | x) )
|
#define ENUcvt(E,x) ( (int)((E + FLD_OFFSET) << 1) | x )
|
||||||
#define ENUon 0x01
|
|
||||||
#define ENUoff 0x00
|
|
||||||
|
|
||||||
// Support for variable width columns (and potentially scrolling too)
|
// Support for variable width columns (and potentially scrolling too)
|
||||||
#define VARcol(E) (-1 == Fieldstab[E].width)
|
#define VARcol(E) (-1 == Fieldstab[E].width)
|
||||||
|
Loading…
Reference in New Issue
Block a user