Remove bit fields
Before removing bit fields: $ size find text data bss dec hex filename 16751 968 48 17767 4567 find After removing bit fields: $ size find text data bss dec hex filename 16527 968 68 17563 449b find This is an example where bit fields uses more memory than integers or char. There is going to be only one gflags struct, so the waste in instructions is bigger than the space saved by bit fields. In the case of Permarg, Sizearg, Execarg there is only one bit field, so at least one unsigned is used, so there is no any gain.
This commit is contained in:
parent
19fb7f115d
commit
b8fbaa9b0d
18
find.c
18
find.c
|
@ -64,7 +64,7 @@ struct Tok {
|
||||||
/* structures used for Arg.extra.p and Tok.extra.p */
|
/* structures used for Arg.extra.p and Tok.extra.p */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
unsigned int exact:1;
|
unsigned char exact;
|
||||||
} Permarg;
|
} Permarg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -83,7 +83,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Narg n;
|
Narg n;
|
||||||
unsigned int bytes:1; /* size is in bytes, not 512 byte sectors */
|
unsigned char bytes; /* size is in bytes, not 512 byte sectors */
|
||||||
} Sizearg;
|
} Sizearg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -100,7 +100,7 @@ typedef struct {
|
||||||
} p; /* plus */
|
} p; /* plus */
|
||||||
} u;
|
} u;
|
||||||
char **argv; /* NULL terminated list of arguments (allocated if isplus) */
|
char **argv; /* NULL terminated list of arguments (allocated if isplus) */
|
||||||
unsigned int isplus:1; /* -exec + instead of -exec ; */
|
unsigned char isplus; /* -exec + instead of -exec ; */
|
||||||
} Execarg;
|
} Execarg;
|
||||||
|
|
||||||
/* used to find loops while recursing through directory structure */
|
/* used to find loops while recursing through directory structure */
|
||||||
|
@ -221,14 +221,14 @@ size_t envlen; /* number of bytes in environ, used to calculate against ARG_MAX
|
||||||
size_t argmax; /* value of ARG_MAX retrieved using sysconf(3p) */
|
size_t argmax; /* value of ARG_MAX retrieved using sysconf(3p) */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned ret :1; /* return value from main */
|
unsigned ret ; /* return value from main */
|
||||||
unsigned depth:1; /* -depth, directory contents before directory itself */
|
unsigned depth; /* -depth, directory contents before directory itself */
|
||||||
unsigned h :1; /* -H, follow symlinks on command line */
|
unsigned h ; /* -H, follow symlinks on command line */
|
||||||
unsigned l :1; /* -L, follow all symlinks (command line and search) */
|
unsigned l ; /* -L, follow all symlinks (command line and search) */
|
||||||
unsigned prune:1; /* hit -prune, eval should return STW_PRUNE (return values
|
unsigned prune; /* hit -prune, eval should return STW_PRUNE (return values
|
||||||
traversing expression tree are boolean so we can't
|
traversing expression tree are boolean so we can't
|
||||||
easily return this. instead set a global flag) */
|
easily return this. instead set a global flag) */
|
||||||
unsigned xdev :1; /* -xdev, prune directories on different devices */
|
unsigned xdev ; /* -xdev, prune directories on different devices */
|
||||||
} gflags;
|
} gflags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user