0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

Change cloc_t to struct location, and reorder the members

Change cloc_t to struct location, and reorder the members so that it
should fit in 16 bytes instead of needing 8 bytes of extra padding on
64-bit machines.
This commit is contained in:
H. Peter Anvin
2007-10-03 21:30:57 -07:00
parent bfc1712137
commit 12e46510bc
6 changed files with 10 additions and 10 deletions

4
eval.c
View File

@@ -44,7 +44,7 @@ static struct tokenval *tokval; /* The current token */
static int i; /* The t_type of tokval */ static int i; /* The t_type of tokval */
static void *scpriv; static void *scpriv;
static cloc_t *location; /* Pointer to current line's segment,offset */ static struct location *location; /* Pointer to current line's segment,offset */
static int *opflags; static int *opflags;
static struct eval_hints *hint; static struct eval_hints *hint;
@@ -813,7 +813,7 @@ static expr *expr6(int critical)
} }
void eval_global_info(struct ofmt *output, lfunc lookup_label, void eval_global_info(struct ofmt *output, lfunc lookup_label,
cloc_t * locp) struct location * locp)
{ {
outfmt = output; outfmt = output;
labelfunc = lookup_label; labelfunc = lookup_label;

2
eval.h
View File

@@ -15,7 +15,7 @@
* look labels up. * look labels up.
*/ */
void eval_global_info(struct ofmt *output, lfunc lookup_label, void eval_global_info(struct ofmt *output, lfunc lookup_label,
cloc_t * locp); struct location * locp);
/* /*
* The evaluator itself. * The evaluator itself.

2
nasm.c
View File

@@ -69,7 +69,7 @@ static uint32_t cmd_cpu = IF_PLEVEL; /* highest level by default */
static uint32_t cpu = IF_PLEVEL; /* passed to insn_size & assemble.c */ static uint32_t cpu = IF_PLEVEL; /* passed to insn_size & assemble.c */
int global_offset_changed; /* referenced in labels.c */ int global_offset_changed; /* referenced in labels.c */
static cloc_t location; static struct location location;
int in_abs_seg; /* Flag we are in ABSOLUTE seg */ int in_abs_seg; /* Flag we are in ABSOLUTE seg */
int32_t abs_seg; /* ABSOLUTE segment basis */ int32_t abs_seg; /* ABSOLUTE segment basis */
int32_t abs_offset; /* ABSOLUTE offset */ int32_t abs_offset; /* ABSOLUTE offset */

6
nasm.h
View File

@@ -190,11 +190,11 @@ enum floatize {
FLOAT_128H, FLOAT_128H,
}; };
typedef struct { struct location {
int32_t segment;
int64_t offset; int64_t offset;
int32_t segment;
int known; int known;
} cloc_t; };
/* /*
* Expression-evaluator datatype. Expressions, within the * Expression-evaluator datatype. Expressions, within the

View File

@@ -36,9 +36,9 @@ static int i;
static struct tokenval tokval; static struct tokenval tokval;
static efunc error; static efunc error;
static struct ofmt *outfmt; /* Structure of addresses of output routines */ static struct ofmt *outfmt; /* Structure of addresses of output routines */
static cloc_t *location; /* Pointer to current line's segment,offset */ static struct location *location; /* Pointer to current line's segment,offset */
void parser_global_info(struct ofmt *output, cloc_t * locp) void parser_global_info(struct ofmt *output, struct location * locp)
{ {
outfmt = output; outfmt = output;
location = locp; location = locp;

View File

@@ -10,7 +10,7 @@
#ifndef NASM_PARSER_H #ifndef NASM_PARSER_H
#define NASM_PARSER_H #define NASM_PARSER_H
void parser_global_info(struct ofmt *output, cloc_t * locp); void parser_global_info(struct ofmt *output, struct location * locp);
insn *parse_line(int pass, char *buffer, insn * result, insn *parse_line(int pass, char *buffer, insn * result,
efunc error, evalfunc evaluate, ldfunc ldef); efunc error, evalfunc evaluate, ldfunc ldef);
void cleanup_insn(insn * instruction); void cleanup_insn(insn * instruction);