summaryrefslogtreecommitdiff
path: root/include/ultra64/gu.h
blob: d0548b3a8d4d44b5343478bd887d26e37359cc3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef ULTRA64_GU_H
#define ULTRA64_GU_H

#include "ultratypes.h"

#define GU_PI 3.1415926

#define FTOFIX32(x) (s32)((x) * (f32)0x00010000)
#define FIX32TOF(x) ((f32)(x) * (1.0f / (f32)0x00010000))

#define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5))

typedef union du {
    struct {
        u32 hi;
        u32 lo;
    } word;

    f64 d;
} du;

typedef union fu {
    u32 i;
    f32 f;
} fu;

f32 sinf(f32 angle);
s16 sins(u16 angle);

f32 cosf(f32 angle);
s16 coss(u16 angle);

extern f32 __libm_qnan_f;

#endif