mips WIFSTOPPED macro evaluates argument twice

Rich Felker dalias at aerifal.cx
Sun Aug 11 03:54:23 UTC 2013


Hi,

The recent changes to fix the WIFSTOPPED macro on mips for SIG_127
issues has introduced a regression: WIFSTOPPED now evaluates its
argument more than once. While probably not a big deal, I did manage
to work out a version that only evaluates the argument once, which we
are now using in musl:

#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)

The idea is basically just flipping the low/high bytes then doing a
range comparison against the range [0x7f01,0x7fff].

Rich


More information about the uClibc mailing list