On 22/07/18 21:46, Ramsay Jones wrote: > > > On 22/07/18 21:31, Ramsay Jones wrote: >> >> >> On 22/07/18 21:26, Ramsay Jones wrote: >> [snip] >>>> +* shift instructions: >>>> + the type of the result must be the same as the type >>>> + of the left operand but the type of the right operand >>>> + is independent. >>> >>> But for constant shifts, the shift direction can be flipped >>> and the shift amount made non-negative, right? >> >> Hmm, except that is not allowed by the C standard? (need to >> check). > > Yep, C11, 6.5.7-3 says: > > 3 The integer promotions are performed on each of the operands. The > type of the result is that of the promoted left operand. If the > value of the right operand is negative or is greater than or equal > to the width of the promoted left operand, the behavior is undefined. > > ... and a few experiments with gcc seems to indicate that negative > shifts (left or right) return zero. If I had read the following series first, of course ... :D Sigh. ATB, Ramsay Jones -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html