From a8e94784b4567d1c770d567c09d06eda9845d88b Mon Sep 17 00:00:00 2001 From: stelzo Date: Thu, 20 Feb 2025 23:00:22 +0100 Subject: [PATCH] fix transmute --- Cargo.toml | 2 +- crates/typst-utils/src/scalar.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b4c2e6a8..bf8d1560 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [workspace.package] version = "0.13.0" -rust-version = "1.85" # also change in ci.yml +rust-version = "1.80" # also change in ci.yml authors = ["The Typst Project Developers"] edition = "2021" homepage = "https://typst.app" diff --git a/crates/typst-utils/src/scalar.rs b/crates/typst-utils/src/scalar.rs index 4036c231..3f517a60 100644 --- a/crates/typst-utils/src/scalar.rs +++ b/crates/typst-utils/src/scalar.rs @@ -44,7 +44,7 @@ impl Scalar { const fn is_nan(x: f64) -> bool { // Safety: all bit patterns are valid for u64, and f64 has no padding bits. // We cannot use `f64::to_bits` because it is not const. - let x_bits = unsafe { std::mem::transmute::(x) }; + let x_bits = x.to_bits(); (x_bits << 1 >> (64 - 12 + 1)) == 0b0_111_1111_1111 && (x_bits << 12) != 0 }