blob: 8fd3bfc5f85e682498a1ef1e2f2a0e3caf02e5ec (
plain)
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
|
/* { dg-do compile } */
/* { dg-options "-O2 -msse2 -ftree-vectorize -march=nocona" } */
typedef __SIZE_TYPE__ size_t;
extern void *malloc (size_t);
extern void free (void *);
typedef struct _Resource
{
struct _Resource *next;
unsigned int id;
} ResourceRec, *ResourcePtr;
typedef struct _ClientResource
{
ResourcePtr *resources;
int elements;
int buckets;
int hashsize;
} ClientResourceRec;
static ClientResourceRec clientTable[256];
void
RebuildTable (int client)
{
int j;
ResourcePtr res, next;
ResourcePtr **tails, *resources;
ResourcePtr **tptr, *rptr;
j = 2 * clientTable[client].buckets;
tails =
(ResourcePtr **) malloc ((unsigned long) (j * sizeof (ResourcePtr *)));
resources =
(ResourcePtr *) malloc ((unsigned long) (j * sizeof (ResourcePtr)));
for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
{
*rptr = ((ResourcePtr) ((void *) 0));
*tptr = rptr;
}
clientTable[client].hashsize++;
for (j = clientTable[client].buckets,
rptr = clientTable[client].resources; --j >= 0; rptr++)
{
for (res = *rptr; res; res = next)
{
next = res->next;
res->next = ((ResourcePtr) ((void *) 0));
tptr = &tails[Hash (client, res->id)];
**tptr = res;
*tptr = &res->next;
}
}
free ((void *) tails);
clientTable[client].buckets *= 2;
free ((void *) clientTable[client].resources);
clientTable[client].resources = resources;
}
/* { dg-final { scan-assembler-not "movlps" } } */
|