Standard way to supply hints to branches

Manu turkeyman at gmail.com
Fri Aug 30 02:54:28 UTC 2024


On Fri, 30 Aug 2024 at 04:32, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 8/28/2024 2:45 AM, Manu wrote:
> > Here's one that I just wrote a short while ago:
> > https://gist.github.com/TurkeyMan/0e49da245cc0086f852ac18deed21a9c
>
>
> ```
> if (data.length < 4) // unlikely
>      return 0;
> ```
>
> replace with:
>
> ```
> if (data.length < 4)
>      goto Lreturn0;
> ```
>

How is that any different? The branch prediction hasn't changed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20240830/884a2c93/attachment.htm>


More information about the Digitalmars-d mailing list