From a7454f42bab35400eb8a651e4dfb8ef4a596e713 Mon Sep 17 00:00:00 2001 From: nic-gaffney Date: Sun, 25 Jun 2023 22:26:53 -0500 Subject: removed old standard libarby --- sloth/src/sloth_std.rs | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 sloth/src/sloth_std.rs diff --git a/sloth/src/sloth_std.rs b/sloth/src/sloth_std.rs deleted file mode 100644 index 7e10297..0000000 --- a/sloth/src/sloth_std.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::ffi::{c_char, CStr}; - -use rand::Rng; - -#[no_mangle] -pub extern "C" fn rand(a: i64, b: i64) -> i64 { - rand::thread_rng().gen_range(a..b) -} - -#[no_mangle] -/// # Safety -/// -/// Function is unsafe if passed pointer is not a valid CStr -pub unsafe extern "C" fn println(s: *const c_char) { - let s = unsafe { CStr::from_ptr(s) }.to_str().unwrap(); - println!("{s}"); -} - -#[no_mangle] -/// # Safety -/// -/// Function is unsafe if passed pointer is not a valid CStr -pub unsafe extern "C" fn print(s: *const c_char) { - let s = unsafe { CStr::from_ptr(s) }.to_str().unwrap(); - print!("{s}"); -} -- cgit v1.2.3