From b09ef4c1ae2f4eb02750f7c5ea0e8a6a3d482e08 Mon Sep 17 00:00:00 2001 From: Nathan Sashihara <21227491+n8sh@users.noreply.github.com> Date: Wed, 25 Nov 2020 20:26:35 -0800 Subject: [PATCH] Change private function BigInt.isNegative to an alias --- std/bigint.d | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/std/bigint.d b/std/bigint.d index 95829cdb2..4b640220a 100644 --- a/std/bigint.d +++ b/std/bigint.d @@ -1286,7 +1286,7 @@ public: } assert(buff.length > 0, "Invalid buffer length"); - char signChar = isNegative() ? '-' : 0; + char signChar = isNegative ? '-' : 0; auto minw = buff.length + (signChar ? 1 : 0); if (!hex && !signChar && (f.width == 0 || minw < f.width)) @@ -1459,10 +1459,7 @@ private: { return data.isZero(); } - bool isNegative() pure const nothrow @nogc @safe - { - return sign; - } + alias isNegative = sign; // Generate a runtime error if division by zero occurs void checkDivByZero() pure const nothrow @safe @@ -2160,23 +2157,23 @@ unittest { auto x = BigInt(-3); x %= 3; - assert(!x.isNegative()); - assert(x.isZero()); + assert(!x.isNegative); + assert(x.isZero); x = BigInt(-3); x %= cast(ushort) 3; - assert(!x.isNegative()); - assert(x.isZero()); + assert(!x.isNegative); + assert(x.isZero); x = BigInt(-3); x %= 3L; - assert(!x.isNegative()); - assert(x.isZero()); + assert(!x.isNegative); + assert(x.isZero); x = BigInt(3); x %= -3; - assert(!x.isNegative()); - assert(x.isZero()); + assert(!x.isNegative); + assert(x.isZero); } // https://issues.dlang.org/show_bug.cgi?id=15678