fn unlikely
c, which the optimizer may assume to be usually false: if unlikely(failed) { ... }.
Example:
use std.opt { unlikely }
fn main() io {
let failed = false
if unlikely(failed) {
print("rare path")
} else {
print("usual path")
}
}Output
usual path
@intrinsic("opt.unlikely") pub(api) fn unlikely(c: bool) -> boolComplexity. O(1); the hint costs nothing at run time.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
c | bool |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/opt/opt.oxl:60