1 /** Tests covering rotate operations
12 #ifndef __SDCC_pdk14 // Lack of memory
13 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
21 # define TEST_VECT 0xa4
23 # define TEST_VECT 0x53
28 # define TYPE uint16_t
30 # define TEST_VECT 0xa8ce
32 # define TEST_VECT 0x5357
37 # define TYPE uint32_t
39 # define TEST_VECT 0xa8c5a5c6
41 # define TEST_VECT 0x55357553
46 # define TYPE uint64_t
48 # define TEST_VECT 0xa8c5a5c655357553
50 # define TEST_VECT 0x55357553a8c5a5c6
54 TYPE
rol1(TYPE s
){ return (s
<<1) | (s
>>(SIZE
-1)); }
55 TYPE
rol2(TYPE s
){ return (s
<<2) | (s
>>(SIZE
-2)); }
56 TYPE
rol3(TYPE s
){ return (s
<<3) | (s
>>(SIZE
-3)); }
57 TYPE
rol4(TYPE s
){ return (s
<<4) | (s
>>(SIZE
-4)); }
58 TYPE
rol5(TYPE s
){ return (s
<<5) | (s
>>(SIZE
-5)); }
59 TYPE
rol6(TYPE s
){ return (s
<<6) | (s
>>(SIZE
-6)); }
60 TYPE
rol7(TYPE s
){ return (s
<<7) | (s
>>(SIZE
-7)); }
63 TYPE
rol8 (TYPE s
){ return (s
<<8 ) | (s
>>(SIZE
-8 )); }
64 TYPE
rol9 (TYPE s
){ return (s
<<9 ) | (s
>>(SIZE
-9 )); }
65 TYPE
rol10(TYPE s
){ return (s
<<10) | (s
>>(SIZE
-10)); }
66 TYPE
rol11(TYPE s
){ return (s
<<11) | (s
>>(SIZE
-11)); }
67 TYPE
rol12(TYPE s
){ return (s
<<12) | (s
>>(SIZE
-12)); }
68 TYPE
rol13(TYPE s
){ return (s
<<13) | (s
>>(SIZE
-13)); }
69 TYPE
rol14(TYPE s
){ return (s
<<14) | (s
>>(SIZE
-14)); }
70 TYPE
rol15(TYPE s
){ return (s
<<15) | (s
>>(SIZE
-15)); }
74 TYPE
rol16(TYPE s
){ return (s
<<16) | (s
>>(SIZE
-16)); }
75 TYPE
rol17(TYPE s
){ return (s
<<17) | (s
>>(SIZE
-17)); }
77 TYPE
rol23(TYPE s
){ return (s
<<23) | (s
>>(SIZE
-23)); }
78 TYPE
rol24(TYPE s
){ return (s
<<24) | (s
>>(SIZE
-24)); }
79 TYPE
rol25(TYPE s
){ return (s
<<25) | (s
>>(SIZE
-25)); }
81 TYPE
rol30(TYPE s
){ return (s
<<30) | (s
>>(SIZE
-30)); }
82 TYPE
rol31(TYPE s
){ return (s
<<31) | (s
>>(SIZE
-31)); }
90 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
91 volatile TYPE t
= TEST_VECT
;
96 ASSERT( rol1(u
) == (TYPE
)((TEST_VECT
<<1) | (TEST_VECT
>>(SIZE
-1))) );
97 ASSERT( rol2(u
) == (TYPE
)((TEST_VECT
<<2) | (TEST_VECT
>>(SIZE
-2))) );
98 ASSERT( rol3(u
) == (TYPE
)((TEST_VECT
<<3) | (TEST_VECT
>>(SIZE
-3))) );
99 ASSERT( rol4(u
) == (TYPE
)((TEST_VECT
<<4) | (TEST_VECT
>>(SIZE
-4))) );
100 ASSERT( rol5(u
) == (TYPE
)((TEST_VECT
<<5) | (TEST_VECT
>>(SIZE
-5))) );
101 ASSERT( rol6(u
) == (TYPE
)((TEST_VECT
<<6) | (TEST_VECT
>>(SIZE
-6))) );
102 ASSERT( rol7(u
) == (TYPE
)((TEST_VECT
<<7) | (TEST_VECT
>>(SIZE
-7))) );
105 ASSERT( rol8 (u
) == (TYPE
)((TEST_VECT
<<8 ) | (TEST_VECT
>>(SIZE
-8 ))) );
106 ASSERT( rol9 (u
) == (TYPE
)((TEST_VECT
<<9 ) | (TEST_VECT
>>(SIZE
-9 ))) );
107 ASSERT( rol10(u
) == (TYPE
)((TEST_VECT
<<10) | (TEST_VECT
>>(SIZE
-10))) );
108 ASSERT( rol11(u
) == (TYPE
)((TEST_VECT
<<11) | (TEST_VECT
>>(SIZE
-11))) );
109 ASSERT( rol12(u
) == (TYPE
)((TEST_VECT
<<12) | (TEST_VECT
>>(SIZE
-12))) );
110 ASSERT( rol13(u
) == (TYPE
)((TEST_VECT
<<13) | (TEST_VECT
>>(SIZE
-13))) );
111 ASSERT( rol14(u
) == (TYPE
)((TEST_VECT
<<14) | (TEST_VECT
>>(SIZE
-14))) );
112 ASSERT( rol15(u
) == (TYPE
)((TEST_VECT
<<15) | (TEST_VECT
>>(SIZE
-15))) );
116 ASSERT( rol16(u
) == (TYPE
)((TEST_VECT
<<16) | (TEST_VECT
>>(SIZE
-16))) );
117 ASSERT( rol17(u
) == (TYPE
)((TEST_VECT
<<17) | (TEST_VECT
>>(SIZE
-17))) );
119 ASSERT( rol23(u
) == (TYPE
)((TEST_VECT
<<23) | (TEST_VECT
>>(SIZE
-23))) );
120 ASSERT( rol24(u
) == (TYPE
)((TEST_VECT
<<24) | (TEST_VECT
>>(SIZE
-24))) );
121 ASSERT( rol25(u
) == (TYPE
)((TEST_VECT
<<25) | (TEST_VECT
>>(SIZE
-25))) );
123 ASSERT( rol30(u
) == (TYPE
)((TEST_VECT
<<30) | (TEST_VECT
>>(SIZE
-30))) );
124 ASSERT( rol31(u
) == (TYPE
)((TEST_VECT
<<31) | (TEST_VECT
>>(SIZE
-31))) );