PandA-2024.02
documentation
tutorial_hpca_2023
01-introduction
Exercise7
less.c
Go to the documentation of this file.
1
#include "
aggregate.h
"
2
3
4
int
less
(
const
void
* a,
const
void
* b,
void
* notUsed)
5
{
6
struct
aggregate
* aPtr = (
struct
aggregate
*)a;
7
struct
aggregate
* bPtr = (
struct
aggregate
*)b;
8
9
float
aSum = aPtr->
a0
+
10
aPtr->
a1
+
11
aPtr->
a2
+
12
aPtr->
a3
+
13
aPtr->
a4
+
14
aPtr->
a5
+
15
aPtr->
a6
+
16
aPtr->
a7
;
17
float
bSum = bPtr->
a0
+
18
bPtr->
a1
+
19
bPtr->
a2
+
20
bPtr->
a3
+
21
bPtr->
a4
+
22
bPtr->
a5
+
23
bPtr->
a6
+
24
bPtr->
a7
;
25
int
equal = (bSum - aSum) == 0;
26
if
(equal)
return
0;
27
28
int
lt = (aSum - bSum) < 0;
29
return
lt ? -1 : 1;
30
}
31
aggregate::a2
float a2
Definition:
aggregate.h:8
aggregate::a3
float a3
Definition:
aggregate.h:9
aggregate.h
aggregate::a7
float a7
Definition:
aggregate.h:13
aggregate::a5
float a5
Definition:
aggregate.h:11
aggregate::a4
float a4
Definition:
aggregate.h:10
aggregate::a6
float a6
Definition:
aggregate.h:12
less
int less(const void *a, const void *b, void *notUsed)
Definition:
less.c:4
aggregate::a1
float a1
Definition:
aggregate.h:7
aggregate::a0
float a0
Definition:
aggregate.h:6
aggregate
Definition:
aggregate.h:4
Generated on Mon Feb 12 2024 13:02:47 for PandA-2024.02 by
1.8.13