mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-13 17:57:12 +08:00
regs.pl: Introduce is_register() helper
Instead of opencoded check use inline helper. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
b8e699fb3d
commit
79699d8eda
7
regs.pl
7
regs.pl
@ -134,6 +134,13 @@ if ( $fmt eq 'h' ) {
|
||||
foreach $reg ( sort(keys(%regs)) ) {
|
||||
printf "#define %-15s %2d\n", "REG_NUM_\U${reg}", $regvals{$reg};
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print "static inline int is_register(int reg)\n";
|
||||
print "{\n";
|
||||
print " return reg >= EXPR_REG_START && reg < REG_ENUM_LIMIT;\n";
|
||||
print "}\n";
|
||||
|
||||
print "\n\n#endif /* NASM_REGS_H */\n";
|
||||
} elsif ( $fmt eq 'c' ) {
|
||||
# Output regs.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user