From 6663e947801a9874345cabdd1bbd7815699a3cee Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 9 Jun 2020 16:35:25 +0300 Subject: [PATCH] builtin: add C._likely_ support --- vlib/builtin/cfns.c.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/builtin/cfns.c.v b/vlib/builtin/cfns.c.v index aaaf512ae5..12942404f8 100644 --- a/vlib/builtin/cfns.c.v +++ b/vlib/builtin/cfns.c.v @@ -1,5 +1,10 @@ module builtin +// See cheaders.v: _likely_ is actually a macro, to hint the C compiler +// that the passed boolean expression is very likely to be true, so it +// can generate assembly code, with less chance of branch misprediction. +fn C._likely_(bool) bool + // fn C.memcpy(byteptr, byteptr, int) voidptr