Nicholas Clark wrote:

(do all the unsigned with masks)

Yep


And we ought to make a generic "safe" version of the code for signed
truncation that works for platforms that are any or all of the following
holds

I tried this one:

inline op conv_i1(inout INT) {
#if 1
INTVAL x = $1;
x <<= 24;
x >>= 24;
x &= ~0xff;
x |= $1 & 0xff;
$1 = x;
#else
$1 = (INTVAL)((char)($1));
#endif
goto NEXT();
}

The 24 is something like (INTVAL_SIZE * CHAR_BIT - 8). Should be faster on pipelined processors then a test for negative and branch.

leo


Reply via email to