blob: ebb8aefa0f9dda2bbb2a0e1eaf2428b8b0944fda (
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
|
int test_1 (int i, int j, int k)
{
if (i < j)
return k + 4;
else
return -k;
}
/* Example showing:
- data structure
- loop
- call to "abort". */
struct foo
{
int count;
float *data;
};
float test_2 (struct foo *lhs, struct foo *rhs)
{
float result = 0.0f;
if (lhs->count != rhs->count)
__builtin_abort ();
for (int i = 0; i < lhs->count; i++)
result += lhs->data[i] * rhs->data[i];
return result;
}
|