diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-22 23:26:21 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-22 23:26:21 +0100 |
commit | 8ed1362368dc064fa35bf879c1f905165b990de8 (patch) | |
tree | f8369b0332b760d5c5b20a8b919be155c5b9464c /stage3/math.h | |
parent | 13293ec3238b62c66d323b82e595e860e193b6ed (diff) | |
download | cuddles-8ed1362368dc064fa35bf879c1f905165b990de8.tar.xz |
add rotating cheese
This adds the Cheese3D graphics api and makes the cheese command display a cheese rotating in 3d as a demo
Diffstat (limited to 'stage3/math.h')
-rw-r--r-- | stage3/math.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/stage3/math.h b/stage3/math.h index 6f7ae58..b067409 100644 --- a/stage3/math.h +++ b/stage3/math.h @@ -18,6 +18,23 @@ static inline double sin(double x) return x; } +static inline double cos(double x) +{ + asm("fldl %1; fcos; fstpl %0":"=m"(x):"m"(x)); + return x; +} + +static inline double tan(double x) +{ + asm("fldl %1; fptan; fstpl %0; fstpl %0":"=m"(x):"m"(x)); + return x; +} + +static inline void sincos(double x, double *sin, double *cos) +{ + asm("fldl %2; fsincos; fstpl %0; fstpl %1":"=m"(*sin),"=m"(*cos):"m"(x)); +} + static inline double rad(double x) { return PI / 180.0 * x; |