diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-04-15 05:32:18 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-04-15 05:32:18 +0000 |
commit | 7e1b8e909b9c2a65d9d22b19884d1969bca5c581 (patch) | |
tree | d96ceff85a71b1b0464e59cb8cf18733cc40834a /regs.pl | |
parent | b7314d83f1464055f3f36e71b8aecb135db8e4ce (diff) | |
download | nasm-7e1b8e909b9c2a65d9d22b19884d1969bca5c581.tar.gz nasm-7e1b8e909b9c2a65d9d22b19884d1969bca5c581.tar.bz2 nasm-7e1b8e909b9c2a65d9d22b19884d1969bca5c581.zip |
More perl-like idioms for generating regdis.c
- Don't use an advancing counter through an array to do a push().
- An empty array is written as (), not 0.
Diffstat (limited to 'regs.pl')
-rwxr-xr-x | regs.pl | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -102,12 +102,10 @@ if ( $fmt eq 'h' ) { foreach $class ( sort(keys(%disclass)) ) { printf "static const int %-8s[] = {", $class; @foo = @{$disclass{$class}}; - @bar = 0; - $counter = 0; + @bar = (); for ( $i = 0 ; $i < scalar(@foo) ; $i++ ) { if (defined($foo[$i])) { - $bar[$counter] = "R_\U$foo[$i]\E"; - $counter ++; + push(@bar, "R_\U$foo[$i]\E"); } } print join(',', @bar), "};\n"; |