fix transmute

This commit is contained in:
stelzo 2025-02-20 23:00:22 +01:00
parent 89e0a84ac8
commit a8e94784b4
No known key found for this signature in database
GPG Key ID: FC4EF89052319374
2 changed files with 2 additions and 2 deletions

View File

@ -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"

View File

@ -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::<f64, u64>(x) };
let x_bits = x.to_bits();
(x_bits << 1 >> (64 - 12 + 1)) == 0b0_111_1111_1111 && (x_bits << 12) != 0
}