www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to mark a condition is likeyly or unlikey =?UTF-8?B?77yf?=

reply lili <akozhao tencent.com> writes:
Hi:
     In C there has likely unlikely marco used by condition 
expression。
     #define likely(x) __builtin_expect(!!(x), 1)
     #define unlikely(x) __builtin_expect(!!(x), 0)
     if (likely(var > 1)) do...

     How to do this in Dlang?
Aug 07 2019
parent kinke <kinke gmx.net> writes:
On Wednesday, 7 August 2019 at 11:37:06 UTC, lili wrote:
 How to do this in Dlang?
Just as in C, this isn't standardized, and I don't think DMD has such a thing. For LDC, see https://forum.dlang.org/thread/ecycecfohgcqkfapiplk forum.dlang.org.
Aug 07 2019