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