You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#ifndef _RESULT_H
|
|
|
|
#define _RESULT_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef int64_t result_t;
|
|
|
|
|
|
|
|
#define SUM_FIELDS 3
|
|
|
|
|
|
|
|
// Processing for p1 and p2, will be defined in p1.c, and maybe p2.c?
|
|
|
|
struct proc;
|
|
|
|
|
|
|
|
struct psum {
|
|
|
|
union {
|
|
|
|
struct { result_t forward, up, down; };
|
|
|
|
result_t _fields[SUM_FIELDS];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct nsum {
|
|
|
|
result_t hoz, depth;
|
|
|
|
} position_t;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
static
|
|
|
|
#else
|
|
|
|
extern
|
|
|
|
#endif
|
|
|
|
inline __attribute__((gnu_inline, const)) position_t normalise_position(struct psum p)
|
|
|
|
{
|
|
|
|
return (struct nsum) {
|
|
|
|
.hoz = p.forward,
|
|
|
|
.depth = p.down - p.up,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _RESULT_H */
|