Make MAX_OPERANDS a parameter in insns.pl as well

MAX_OPERANDS is present in insns.pl as well (although proper C
compilers shouldn't need this kind of zero padding.)  Make sure it's
clear to everyone.
This commit is contained in:
H. Peter Anvin 2008-05-12 11:36:24 -07:00
parent aaa088fbf3
commit ff3b57c253
2 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,9 @@
# LONGER PREFIXES FIRST!
@disasm_prefixes = qw(0F24 0F25 0F38 0F3A 0F7A 0FA6 0FA7 0F);
# This should match MAX_OPERANDS from nasm.h
$MAX_OPERANDS = 5;
print STDERR "Reading insns.dat...\n";
@args = ();
@ -299,7 +302,7 @@ sub format {
@ops = split(/\,/, $operands);
}
$num = scalar(@ops);
while (scalar(@ops) < 4) {
while (scalar(@ops) < $MAX_OPERANDS) {
push(@ops, '0');
}
$operands = join(',', @ops);

1
nasm.h
View file

@ -652,6 +652,7 @@ enum prefix_pos {
MAXPREFIX /* Total number of prefix slots */
};
/* If you need to change this, also change it in insns.pl */
#define MAX_OPERANDS 5
typedef struct insn { /* an instruction itself */