#ifndef MATH_H_ #define MATH_H_ #include #include "../bang.h" // Bedrock math device. typedef struct { s16 x, y; // Cartesian write u16 r, t; // Polar write s16 x_read, y_read; // Cartesian read bool x_cached, y_cached; // Cartesian cached u16 r_read, t_read; // Polar read bool r_cached, t_cached; // Polar cached u32 prod_read; // Multiplication read bool prod_cached; // Multiplication cached u16 quot_read, rem_read; // Division read bool quot_cached, rem_cached; // Division cached } MathDevice; // Methods. void math_reset(MathDevice *math); void math_clear_cartesian(MathDevice *math); void math_clear_polar(MathDevice *math); s16 math_get_x(MathDevice *math); s16 math_get_y(MathDevice *math); u16 math_get_r(MathDevice *math); u16 math_get_t(MathDevice *math); u32 math_get_prod(MathDevice *math); u16 math_get_quot(MathDevice *math); u16 math_get_rem(MathDevice *math); #endif