Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/tools/ido5.3_recomp/header.h
7858 views
1
#include <stdio.h>
2
#include <stdint.h>
3
#include <stdlib.h>
4
#include <string.h>
5
#include <math.h>
6
#include <assert.h>
7
8
#include "libc_impl.h"
9
#include "helpers.h"
10
11
#define RM_RN 0
12
#define RM_RZ 1
13
#define RM_RP 2
14
#define RM_RM 3
15
16
union FloatReg {
17
float f[2];
18
uint32_t w[2];
19
double d;
20
};
21
22
#define cvt_w_d(f) \
23
((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0))
24
25
#define cvt_w_s(f) cvt_w_d((double)f)
26
27
static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}},
28
f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}},
29
f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}};
30
static uint32_t fcsr = 1;
31
32