fn likely
c, which the optimizer may assume to be usually true: if likely(x > 0) { ... }.
Example:
use std.opt { likely }
fn main() io {
var sum = 0
for i in 1..=10 {
if likely(i > 0) { sum += i }
}
print("{sum}")
}Output
55
@intrinsic("opt.likely") pub(api) fn likely(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:39