msg_120.c revision 1.3
1/* $NetBSD: msg_120.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ 2# 3 "msg_120.c" 3 4// Test for message: bitwise operation on signed value nonportable [120] 5 6/* lint1-extra-flags: -p */ 7 8int 9shr(int a, int b) 10{ 11 return a >> b; /* expect: 117 */ 12} 13 14int 15shr_lhs_constant_positive(int a) 16{ 17 return 0x1234 >> a; 18} 19 20int 21shr_lhs_constant_negative(int a) 22{ 23 return -0x1234 >> a; /* expect: 120 */ 24} 25 26int 27shr_rhs_constant_positive(int a) 28{ 29 return a >> 0x1234; /* expect: 117, 122 */ 30} 31 32int 33shr_rhs_constant_negative(int a) 34{ 35 return a >> -0x1234; /* expect: 117, 121 */ 36} 37