mirror of https://github.com/stelzo/typst.git
fix transmute
This commit is contained in:
parent
89e0a84ac8
commit
a8e94784b4
|
|
@ -5,7 +5,7 @@ resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.13.0"
|
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"]
|
authors = ["The Typst Project Developers"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
homepage = "https://typst.app"
|
homepage = "https://typst.app"
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ impl Scalar {
|
||||||
const fn is_nan(x: f64) -> bool {
|
const fn is_nan(x: f64) -> bool {
|
||||||
// Safety: all bit patterns are valid for u64, and f64 has no padding bits.
|
// 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.
|
// 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
|
(x_bits << 1 >> (64 - 12 + 1)) == 0b0_111_1111_1111 && (x_bits << 12) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue