Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / bug-460000.c
1 /* bug 460000
2  */
3 #include <testfwk.h>
4
5 int 
6 func( int a )
7 {
8   return a;
9 }
10
11 int x = -1024; 
12
13 void 
14 testByteShift(void) 
15
16   ASSERT(func( x >> 8 ) == -4);
17   ASSERT(func( x / 256 ) == -4);
18
19
20 void
21 testOtherSignedShifts(void)
22 {
23   volatile int left;
24
25   left = -2345;
26   ASSERT(left >> 3 == (-2345>>3));
27   ASSERT(left >> 8 == (-2345>>8));
28   ASSERT(left >> 9 == (-2345>>9));
29 }
30
31 void
32 testShiftByParam(void)
33 {
34   volatile int left, count;
35
36   left = -2345;
37
38   count = 3;
39   ASSERT(left >> count == (-2345>>3));
40   count = 8;
41   ASSERT(left >> count == (-2345>>8));
42   count = 9;
43   ASSERT(left >> count == (-2345>>9));
44 }