Use unsafe blocks in float.h implementation

This commit is contained in:
sourceturner
2026-01-16 21:54:04 +01:00
committed by sourceturner
parent 375061a69c
commit d539b134ef
+4 -1
View File
@@ -2,6 +2,9 @@
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>.
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{
header::_fenv::{FE_TONEAREST, fegetround},
platform::types::c_int,
@@ -13,7 +16,7 @@ pub const FLT_RADIX: c_int = 2;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn flt_rounds() -> c_int {
match fegetround() {
match unsafe { fegetround() } {
FE_TONEAREST => 1,
_ => -1,
}