From 82effd29c472cac9ea54fb6d24e88656517f01a0 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 18 Dec 2025 15:03:45 -0800 Subject: fix stack overflow when running on windows in debug mode --- azalea-core/src/math.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/azalea-core/src/math.rs b/azalea-core/src/math.rs index 4d3bf84c..1e410cb4 100644 --- a/azalea-core/src/math.rs +++ b/azalea-core/src/math.rs @@ -6,8 +6,14 @@ use std::{ pub const EPSILON: f64 = 1.0e-7; -pub static SIN: LazyLock<[f32; 65536]> = - LazyLock::new(|| std::array::from_fn(|i| f64::sin((i as f64) * PI * 2. / 65536.) as f32)); +// has to be boxed to avoid a stack overflow on windows when run in debug mode +pub static SIN: LazyLock> = LazyLock::new(|| { + (0..65536) + .map(|i| f64::sin((i as f64) * PI * 2. / 65536.) as f32) + .collect::>() + .try_into() + .unwrap() +}); /// A sine function that uses a lookup table. pub fn sin(x: f32) -> f32 { -- cgit v1.2.3