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.

41 lines
539 B

#ifndef _RESULT_H
#define _RESULT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef int64_t result_t;
struct psum {
union {
struct { result_t forward, up, down; };
result_t _fields[3];
};
};
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 */