Skip to content

Commit

Permalink
[core.builtins] Improve docs for trap, likely, unlikely (#17491)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel authored Dec 8, 2024
1 parent 06e8c8d commit 2674d22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions druntime/src/core/builtins.d
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ else version (DigitalMars)
return val;
}

/// Execute target dependent trap instruction, if supported.
/// Otherwise, abort execution.
pragma(inline, true)
void trap()
{
Expand All @@ -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); }

0 comments on commit 2674d22

Please sign in to comment.