|
@@ -1,7 +1,7 @@
|
|
|
//! stdlib implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/stdlib.h.html
|
|
|
|
|
|
-use core::{intrinsics, iter, mem, ptr, slice};
|
|
|
use core::convert::TryFrom;
|
|
|
+use core::{intrinsics, iter, mem, ptr, slice};
|
|
|
use rand::distributions::{Alphanumeric, Distribution, Uniform};
|
|
|
use rand::prng::XorShiftRng;
|
|
|
use rand::rngs::JitterRng;
|
|
@@ -381,7 +381,7 @@ pub extern "C" fn labs(i: c_long) -> c_long {
|
|
|
#[no_mangle]
|
|
|
pub unsafe extern "C" fn lcong48(param: *mut c_ushort) {
|
|
|
// Input should be a size-7 array.
|
|
|
-
|
|
|
+
|
|
|
/* Go through this ptr -> u64 -> ptr conversion to ensure we only
|
|
|
* get the lower 16 bits of each element. */
|
|
|
let new_xi = lcg48::uint48_from_ushort_arr3(param.offset(0));
|
|
@@ -707,12 +707,12 @@ pub unsafe extern "C" fn realpath(pathname: *const c_char, resolved: *mut c_char
|
|
|
#[no_mangle]
|
|
|
pub unsafe extern "C" fn seed48(seed16v: *mut c_ushort) -> *mut c_ushort {
|
|
|
lcg48::reset_a_and_c();
|
|
|
-
|
|
|
+
|
|
|
lcg48::STASHED_XI = lcg48::DEFAULT_XI;
|
|
|
-
|
|
|
+
|
|
|
let new_xi = lcg48::uint48_from_ushort_arr3(seed16v);
|
|
|
lcg48::set_ushort_arr3_from_uint48(lcg48::DEFAULT_XI.as_mut_ptr(), new_xi);
|
|
|
-
|
|
|
+
|
|
|
lcg48::STASHED_XI.as_mut_ptr()
|
|
|
}
|
|
|
|
|
@@ -801,7 +801,7 @@ pub unsafe extern "C" fn srand(seed: c_uint) {
|
|
|
#[no_mangle]
|
|
|
pub unsafe extern "C" fn srand48(seedval: c_long) {
|
|
|
lcg48::reset_a_and_c();
|
|
|
-
|
|
|
+
|
|
|
/* Set the high 32 bits of the 48-bit X_i value to the lower 32 bits
|
|
|
* of the input argument, and the lower 16 bits to 0x330e, as
|
|
|
* specified in POSIX. */
|