[core.builtins] Improve docs for trap, likely, unlikely (#17491)

Based on: https://github.com/dlang/dmd/edit/master/changelog/druntime.expect-trap.dd
This commit is contained in:
Nick Treleaven 2024-12-08 06:32:57 +00:00 committed by GitHub
parent 06e8c8d3dd
commit 2674d225aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,6 +78,8 @@ else version (DigitalMars)
return val;
}
/// Execute target dependent trap instruction, if supported.
/// Otherwise, abort execution.
pragma(inline, true)
void trap()
{
@ -90,7 +92,8 @@ else version (DigitalMars)
}
}
/// Provide static branch hints
/// Provide static branch and value hints for the LDC/GDC compilers.
/// DMD ignores these hints.
pragma(inline, true) bool likely(bool b) { return expect(b, true); }
///
/// ditto
pragma(inline, true) bool unlikely(bool b) { return expect(b, false); }