A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ldc-developers/ldc/issues/2458 below:

llvm_expect doesn't work with CTFE · Issue #2458 · ldc-developers/ldc · GitHub

import std.stdio;
import ldc.intrinsics: llvm_expect;

uint notzero()(uint x)
{
    if (llvm_expect(x == 0, false))
        return 1;
    return x;
}
void main(string[] args)
{
    immutable x = notzero(1);
    enum y = notzero(1);
    writefln("x = %d, y = %d", x, y);
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4