diff --git a/ch3/user/src/bin/00power_3.rs b/ch3/user/src/bin/00power_3.rs index 1a04dc7..f5f5adc 100644 --- a/ch3/user/src/bin/00power_3.rs +++ b/ch3/user/src/bin/00power_3.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 3u64; let m = 998244353u64; - let iter: usize = 200000; + let iter: usize = 20000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_3 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/01power_5.rs b/ch3/user/src/bin/01power_5.rs index e47761b..85edaf1 100644 --- a/ch3/user/src/bin/01power_5.rs +++ b/ch3/user/src/bin/01power_5.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 5u64; let m = 998244353u64; - let iter: usize = 140000; + let iter: usize = 14000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_5 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/02power_7.rs b/ch3/user/src/bin/02power_7.rs index a97d2f5..b4e20af 100644 --- a/ch3/user/src/bin/02power_7.rs +++ b/ch3/user/src/bin/02power_7.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 7u64; let m = 998244353u64; - let iter: usize = 160000; + let iter: usize = 16000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_7 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/04loop.rs b/ch3/user/src/bin/04loop.rs new file mode 100644 index 0000000..094066a --- /dev/null +++ b/ch3/user/src/bin/04loop.rs @@ -0,0 +1,18 @@ +#![no_std] +#![no_main] + +#[macro_use] +extern crate user_lib; + +use user_lib::syscall::{sys_get_time, sys_yield}; + +#[no_mangle] +fn main() -> i32 { + let current_timer = sys_get_time(); + let wait_for = current_timer + 3000; + loop { + + } + println!("Test sleep OK!"); + 0 +}