From 1c1ec911673020713fbcd4ae443261369e19d35b Mon Sep 17 00:00:00 2001 From: auronandace Date: Fri, 27 Feb 2026 12:21:54 +0000 Subject: [PATCH] take into account x86 c_long --- src/header/stdlib/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs index 1b0dc328fc..93e10a572c 100644 --- a/src/header/stdlib/mod.rs +++ b/src/header/stdlib/mod.rs @@ -1169,7 +1169,10 @@ pub unsafe extern "C" fn random() -> c_long { /* Both branches of this function result in a "u31", which will * always fit in a c_long. */ - c_long::from(k) + #[cfg(not(target_arch = "x86"))] + return c_long::from(k); + #[cfg(target_arch = "x86")] // c_long on x86 is i32 so not infallible cast + c_long::try_from(k).unwrap() } /// See .