aboutsummaryrefslogtreecommitdiff
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/env.c b/src/env.c
index 71858e3..6d5078a 100644
--- a/src/env.c
+++ b/src/env.c
@@ -1,3 +1,5 @@
+#include <math.h>
+
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_timer.h>
@@ -244,3 +246,22 @@ void w2c_env_0x5Femscripten_set_main_loop(struct w2c_env *env, uint32_t func,
(void)fps;
(void)simulate_infinite_loop;
}
+
+static struct w2c_global shared_global = {
+ .infinity = INFINITY,
+ .nan = NAN,
+};
+
+double *w2c_global_Infinity(struct w2c_global *global) {
+ if (!global) {
+ global = &shared_global;
+ }
+ return &global->infinity;
+}
+
+double *w2c_global_NaN(struct w2c_global *global) {
+ if (!global) {
+ global = &shared_global;
+ }
+ return &global->nan;
+}