On Wed, Jul 17, 2013 at 4:24 PM, Bastiaan Jacques <address@hidden> wrote:
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
+inline boost::uint32_t
+saneShiftParam(boost::int32_t value)
+{
+ // NOTE: ISO-IEC 14882:2003 5.8.1: "The behavior is undefined if the right
+ // operand is negative, or greater than or equal to the length in bits of
+ // the promoted left operand."
+ boost::uint32_t rv = value;
+ return rv % 32;
+}
Regarding efficiency, I would recommend in this case considering the
alternative (with identical results):
return rv & (32 - 1);
which can be rephrased
return rv & 31;
or, if you prefer hexadecimal
return rv & 0x1f;