OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20011008-3.c] - Blame information for rev 711

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
extern void exit (int);
2
extern void abort (void);
3
 
4
typedef unsigned int u_int32_t;
5
typedef unsigned char u_int8_t;
6
typedef int int32_t;
7
 
8
typedef enum {
9
        TXNLIST_DELETE,
10
        TXNLIST_LSN,
11
        TXNLIST_TXNID,
12
        TXNLIST_PGNO
13
} db_txnlist_type;
14
 
15
struct __db_lsn; typedef struct __db_lsn DB_LSN;
16
struct __db_lsn {
17
        u_int32_t file;
18
        u_int32_t offset;
19
};
20
struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST;
21
 
22
struct __db_txnlist {
23
        db_txnlist_type type;
24
        struct { struct __db_txnlist *le_next; struct __db_txnlist **le_prev; } links;
25
        union {
26
                struct {
27
                        u_int32_t txnid;
28
                        int32_t generation;
29
                        int32_t aborted;
30
                } t;
31
                struct {
32
 
33
 
34
                        u_int32_t flags;
35
                        int32_t fileid;
36
                        u_int32_t count;
37
                        char *fname;
38
                } d;
39
                struct {
40
                        int32_t ntxns;
41
                        int32_t maxn;
42
                        DB_LSN *lsn_array;
43
                } l;
44
                struct {
45
                        int32_t nentries;
46
                        int32_t maxentry;
47
                        char *fname;
48
                        int32_t fileid;
49
                        void *pgno_array;
50
                        u_int8_t uid[20];
51
                } p;
52
        } u;
53
};
54
 
55
int log_compare (const DB_LSN *a, const DB_LSN *b)
56
{
57
  return 1;
58
}
59
 
60
 
61
int
62
__db_txnlist_lsnadd(int val, DB_TXNLIST *elp, DB_LSN *lsnp, u_int32_t flags)
63
{
64
   int i;
65
 
66
   for (i = 0; i < (!(flags & (0x1)) ? 1 : elp->u.l.ntxns); i++)
67
     {
68
        int __j;
69
        DB_LSN __tmp;
70
        val++;
71
        for (__j = 0; __j < elp->u.l.ntxns - 1; __j++)
72
          if (log_compare(&elp->u.l.lsn_array[__j], &elp->u.l.lsn_array[__j + 1]) < 0)
73
          {
74
             __tmp = elp->u.l.lsn_array[__j];
75
             elp->u.l.lsn_array[__j] = elp->u.l.lsn_array[__j + 1];
76
             elp->u.l.lsn_array[__j + 1] = __tmp;
77
          }
78
     }
79
 
80
   *lsnp = elp->u.l.lsn_array[0];
81
   return val;
82
}
83
 
84
#ifndef STACK_SIZE
85
#define VLEN    1235
86
#else
87
#define VLEN (STACK_SIZE/10)
88
#endif
89
 
90
int main (void)
91
{
92
  DB_TXNLIST el;
93
  DB_LSN lsn, lsn_a[VLEN];
94
 
95
  el.u.l.ntxns = VLEN-1;
96
  el.u.l.lsn_array = lsn_a;
97
 
98
  if (__db_txnlist_lsnadd (0, &el, &lsn, 0) != 1)
99
    abort ();
100
 
101
  if (__db_txnlist_lsnadd (0, &el, &lsn, 1) != VLEN-1)
102
    abort ();
103
 
104
  exit (0);
105
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.