On 21 December 2006 21:54, Ayal Zaks wrote: >> Something along these lines may be useful to do in the vectorizer when we >> get code like this: > ((char)x) = ((char)( ((int)((char)x)) << >> ((int)c) ) ) >> and don't feel like doing all the unpacking of chars to ints and then >> packing the ints to chars after the shift. An alternative could be to >> transform the above pattern to: >> char_x1 = 0 >> char_x2 = char_x << c >> char_x = ((int)c < size_of_char) ? char_x2 : char_x1 >> and vectorize that (since we already know how to vectorize selects). > > Alternatively, do > char_c2 = (c < size_of_char ? c : 0) > char_x2 = char_x << char_c2 > which is like saturating the shift amount.
You don't really mean zero as the third operand of that ternary operator, you want size_of_char. cheers, DaveK -- Can't think of a witty .sigline today....