I have a template which has a bit where it negates a value. This works well until it encountered a short, where ldc2 complained:

integral promotion not done for -val

I ended up with this, but is negating a short really this problematic, or did I miss something?

    static if (!__traits(isUnsigned, T)) {
        if (val < 0) {
static if (__traits(getPointerBitmap, T)[0] < int.sizeof) {
                val = cast(T)(-(cast(int)val));
            } else {
                val = -val;
            }
        }
    }

As always, thanks much in advance,
Andy

Reply via email to