feat: ✨ Add loop_while() fn
This commit is contained in:
parent
33dbf79041
commit
16ec45b97c
|
@ -39,3 +39,14 @@ pub fn loop_until<F: Fn() -> bool>(f: F) {
|
|||
asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
/// Loop while a passed function returns `true`.
|
||||
#[inline]
|
||||
pub fn loop_while<F: Fn() -> bool>(f: F) {
|
||||
loop {
|
||||
if !f() {
|
||||
break;
|
||||
}
|
||||
asm::nop();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue