File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change 22
33void t () {
44 int x = 10 ;
5- int y = 1 ;
5+ int y = 5 ;
66
7- int a = y << x ;
8- int b = y >> x ;
7+ int a = ( x < y ) << 1 ;
8+ int b = ( x < y ) >> 1 ;
99
10- int c = 0 << x ;
11- int d = 0 >> x ;
10+ int c = ( x > y ) << 1 ;
11+ int d = ( x > y ) >> 1 ;
1212
13- int e = y << 1 ;
14- int f = y >> 1 ;
13+ int e = ( x == y ) << 1 ;
14+ int f = ( x == y ) >> 1 ;
1515
16- int g = y << -1 ; // expected-warning {{shift count is negative}}
17- int h = y >> -1 ; // expected-warning {{shift count is negative}}
16+ int g = ( x != y ) << 1 ;
17+ int h = ( x != y ) >> 1 ;
1818
19- int i = y << 0 ;
20- int j = y >> 0 ;
19+ int i = ( x < y ) << 0 ;
20+ int j = ( x < y ) >> 0 ;
2121
22- if ((y << 1 ) != 0 ) { }
23- if ((y >> 1 ) != 0 ) { }
22+ int k = (x < y ) << -1 ; // expected-warning {{shift count is negative}}
23+ int l = (x < y ) >> -1 ; // expected-warning {{shift count is negative}}
24+
25+ if (((x < y ) << 1 ) != 0 ) { }
26+ if (((x < y ) >> 1 ) != 0 ) { }
2427}
You can’t perform that action at this time.
0 commit comments