forked from adtools/clib2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_mul_div_functions.c
75 lines (59 loc) · 1.25 KB
/
test_mul_div_functions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Checks the mul/div functions
#include <exec/types.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <clib/alib_protos.h>
#include <string.h>
extern struct ExecBase *SysBase;
extern struct DosLibrary *DOSBase;
extern LONG __modsi3(LONG dividend,LONG divisor);
extern LONG __mulsi3(LONG Arg1,LONG Arg2);
extern ULONG __udivsi3(ULONG dividend,ULONG divisor);
extern ULONG __umodsi3(ULONG dividend,ULONG divisor);
#define VAL1 -100025L
#define VAL2 257L
#define REMAINDER1 -52L
#define MUL2 -25706425L
#define VAL3 568970L
#define VAL4 5686L
#define QUOTIENT3 100L
#define REMAINDER4 370L
WORD testMulDivFunctions(void)
{
WORD errCnt = 0;
LONG sres;
ULONG res;
sres = __modsi3(VAL1,VAL2);
#if OPTION_TRACE
Printf("sres = %ld\n",sres);
#endif
if(sres != REMAINDER1)
{
errCnt++;
}
sres = __mulsi3(VAL1,VAL2);
#if OPTION_TRACE
Printf("sres = %ld\n",sres);
#endif
if(sres != MUL2)
{
errCnt++;
}
res = __udivsi3(VAL3,VAL4);
#if OPTION_TRACE
Printf("res = %ld\n",res);
#endif
if(res != QUOTIENT3)
{
errCnt++;
}
res = __umodsi3(VAL3,VAL4);
#if OPTION_TRACE
Printf("res = %ld\n",res);
#endif
if(res != REMAINDER4)
{
errCnt++;
}
return(errCnt);
}