1 /** Simple test for the mul/div/mod operations.
10 testUnsignedModDiv(void)
12 {attr} {storage} unsigned {type} i;
13 unsigned {type} result;
33 {attr} {storage} unsigned {type} i;
34 unsigned {type} result;
38 LOG(("i*3 == 111 = %u\n", i*3));
40 ASSERT(result == 111);
43 ASSERT(result == (({type})444));
49 {attr} {storage} signed {type} i;
54 LOG(("i*5 == 25 = %u\n", (int)i*5));
57 LOG(("i*-4 == -20 = %u\n", (int)i*-4));
61 LOG(("i*12 == -120 = %u\n", (int)i*12));
63 LOG(("i*-3 == 30 = %u\n", (int)i*-3));
66 LOG(("30 == %u\n", (int)i*-3));
72 {attr} {storage} signed {type} i;
75 LOG(("i/5 == 20 = %u\n", (int)i/5));
77 LOG(("i/-4 == -25 = %u\n", (int)i/-4));
81 LOG(("i/25 == -2 = %u\n", (int)i/25));
83 LOG(("i/-12 == 4 = %u\n", (int)i/-12));
90 {attr} {storage} signed {type} i;
92 // Disabled the LOG functions due to a bug in sdcc involving
95 // LOG(("i%%17 == 15 = %u\n", (int)(i%9)));
98 #if MOD_SIGN_FOLLOWS_DIVIDEND
99 // LOG(("i%%-7 == 2 = %u\n", (int)i%-7));
103 // LOG(("i%%3 == -1 = %u\n", (int)i%3));
105 // LOG(("i%%-5 == -4 = %u\n", (int)i%-5));