~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to tests/cris/check_int64.c

  • Committer: bellard
  • Date: 2003-03-23 20:17:16 UTC
  • Revision ID: git-v1:3ef693a03205217a5def9318b443c8cb6de17217
distribution patches


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@44 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <stdlib.h>
3
 
#include <stdint.h>
4
 
#include "sys.h"
5
 
#include "crisutils.h"
6
 
 
7
 
 
8
 
extern inline int64_t add64(const int64_t a, const int64_t b) {
9
 
        return a + b;
10
 
}
11
 
 
12
 
extern inline int64_t sub64(const int64_t a, const int64_t b) {
13
 
        return a - b;
14
 
}
15
 
 
16
 
int main(void)
17
 
{
18
 
        int64_t a = 1;
19
 
        int64_t b = 2;
20
 
 
21
 
        /* FIXME: add some tests.  */
22
 
        a = add64(a, b);
23
 
        if (a != 3)
24
 
                err();
25
 
 
26
 
        a = sub64(a, b);
27
 
        if (a != 1)
28
 
                err();
29
 
 
30
 
        a = add64(a, -4);
31
 
        if (a != -3)
32
 
                err();
33
 
 
34
 
        a = add64(a, 3);
35
 
        if (a != 0)
36
 
                err();
37
 
 
38
 
        a = 0;
39
 
        a = sub64(a, 1);
40
 
        if (a != -1)
41
 
                err();
42
 
 
43
 
        pass();
44
 
        return 0;
45
 
}