mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
compiler.h: only use watcom_switch_hack() if necessary
Use sizeof() to prevent the compiler from invoking watcom_switch_hack() unnecessarily. Hopefully the optimizer would be smart enough to recognize this inherently, but this is an old compiler we are dealing with, so make life a little easier for it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
4d32674144
commit
e3cd70bc46
@ -261,7 +261,7 @@ static inline unsigned int watcom_switch_hack(uint64_t x)
|
||||
return (unsigned int)x;
|
||||
}
|
||||
|
||||
# define switch(x) switch(watcom_switch_hack(x))
|
||||
# define switch(x) switch(sizeof(x) > sizeof(unsigned int) ? watcom_switch_hack(x) : (x))
|
||||
# define default case BOGUS_CASE: default
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user