Lines Matching refs:rhs

346     this(U)(U rhs)
348 !isIntegral!T && is(typeof(T(rhs))) ||
350 is(typeof(Checked!(T, Hook)(rhs.get))))
353 payload = rhs;
355 payload = rhs.payload;
375 ref Checked opAssign(U)(U rhs) return
376 if (is(typeof(Checked!(T, Hook)(rhs))))
379 payload = rhs;
381 payload = rhs.payload;
513 bool opEquals(U, this _)(U rhs)
515 is(U == Checked!(V, W), V, W) && is(typeof(this == rhs.payload)))
519 alias R = typeof(payload + rhs.payload);
523 return this == rhs.payload;
527 return payload == rhs.payload;
531 return hook.hookOpEquals(payload, rhs.payload);
535 return rhs.hook.hookOpEquals(rhs.payload, payload);
539 return payload == rhs.payload;
543 return hook.hookOpEquals(payload, rhs);
545 return payload == rhs;
556 static bool hookOpEquals(L, R)(L lhs, R rhs)
558 if (lhs != rhs) return false;
561 if (lhs > 0 && rhs < 0) thereWereErrors = true;
564 if (lhs < 0 && rhs > 0) thereWereErrors = true;
577 static bool hookOpEquals(L, R)(L lhs, R rhs)
579 return lhs == rhs;
722 auto opCmp(U, this _)(const U rhs) //const pure @safe nothrow @nogc
727 return hook.hookOpCmp(payload, rhs);
731 return payload < rhs ? -1 : payload > rhs;
736 return lhs < rhs ? U(-1.0)
737 : lhs > rhs ? U(1.0)
738 : lhs == rhs ? U(0.0) : U.init;
742 return payload < rhs ? -1 : payload > rhs;
747 auto opCmp(U, Hook1, this _)(Checked!(U, Hook1) rhs)
749 alias R = typeof(payload + rhs.payload);
752 return payload < rhs.payload ? -1 : payload > rhs.payload;
757 return this.opCmp(rhs.payload);
761 return hook.hookOpCmp(get, rhs.get);
765 return -rhs.hook.hookOpCmp(rhs.payload, get);
769 return payload < rhs.payload ? -1 : payload > rhs.payload;
781 static int hookOpCmp(L, R)(L lhs, R rhs)
785 if (rhs < 0 && rhs >= lhs)
790 if (lhs < 0 && lhs >= rhs)
794 return lhs < rhs ? -1 : lhs > rhs;
802 static int hookOpCmp(L, R)(L lhs, R rhs)
805 return lhs < rhs ? -1 : lhs > rhs;
949 auto opBinary(string op, Rhs)(const Rhs rhs)
952 return opBinaryImpl!(op, Rhs, typeof(this))(rhs);
956 auto opBinary(string op, Rhs)(const Rhs rhs) const
959 return opBinaryImpl!(op, Rhs, typeof(this))(rhs);
962 private auto opBinaryImpl(string op, Rhs, this _)(const Rhs rhs)
971 auto r = hook.hookOpBinary!op(payload, rhs);
985 auto r = opChecked!op(payload, rhs, overflow);
986 if (overflow) r = hook.onOverflow!op(payload, rhs);
997 auto opBinary(string op, U, Hook1)(Checked!(U, Hook1) rhs)
999 return opBinaryImpl2!(op, U, Hook1, typeof(this))(rhs);
1003 auto opBinary(string op, U, Hook1)(Checked!(U, Hook1) rhs) const
1005 return opBinaryImpl2!(op, U, Hook1, typeof(this))(rhs);
1009 auto opBinaryImpl2(string op, U, Hook1, this _)(Checked!(U, Hook1) rhs)
1011 alias R = typeof(get + rhs.payload);
1020 return hook.hookOpBinary!op(payload, rhs);
1057 static auto hookOpBinary(string x, L, R)(L lhs, R rhs)
1138 static auto hookOpBinaryRight(string x, L, R)(L lhs, R rhs)
1184 ref Checked opOpAssign(string op, Rhs)(const Rhs rhs) return
1191 hook.hookOpOpAssign!op(payload, rhs);
1195 alias R = typeof(get + rhs);
1196 auto r = opBinary!op(rhs).get;
1225 ref Checked opOpAssign(string op, Rhs)(const Rhs rhs) return
1228 return opOpAssign!(op, typeof(rhs.payload))(rhs.payload);
1237 static T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1242 static T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1266 Lhs onLowerBound(Rhs, T)(Rhs rhs, T bound) { return cast(T) rhs; }
1267 T onUpperBound(Rhs, T)(Rhs rhs, T bound) { return cast(T) rhs; }
1268 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs) { return lhs == rhs; }
1269 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs) { return (lhs > rhs) - (lhs < rhs); }
1271 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1274 return typeof(lhs / rhs).min;
1381 T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1383 Warn.onLowerBound(rhs, bound);
1387 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1389 Warn.onUpperBound(rhs, bound);
1409 static bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1412 auto result = opChecked!"=="(lhs, rhs, error);
1415 Warn.hookOpEquals(lhs, rhs);
1441 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1444 auto result = opChecked!"cmp"(lhs, rhs, error);
1447 Warn.hookOpCmp(lhs, rhs);
1473 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1475 Warn.onOverflow!x(lhs, rhs);
1565 static T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1568 Rhs.stringof, rhs, T.stringof, bound);
1571 static T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1574 Rhs.stringof, rhs, T.stringof, bound);
1593 static bool hookOpEquals(L, R)(L lhs, R rhs)
1596 auto result = opChecked!"=="(lhs, rhs, error);
1600 L.stringof, lhs, R.stringof, rhs);
1626 static int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1629 auto result = opChecked!"cmp"(lhs, rhs, error);
1633 Lhs.stringof, lhs, Rhs.stringof, rhs);
1662 static typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1665 Lhs.stringof, lhs, x, Rhs.stringof, rhs);
1740 T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1743 Rhs.stringof, rhs, T.stringof, bound);
1744 return cast(T) rhs;
1747 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1750 Rhs.stringof, rhs, T.stringof, bound);
1751 return cast(T) rhs;
1770 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1773 auto result = opChecked!"=="(lhs, rhs, error);
1777 Lhs.stringof, lhs, Rhs.stringof, rhs);
1778 return lhs == rhs;
1809 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1812 auto result = opChecked!"cmp"(lhs, rhs, error);
1816 Lhs.stringof, lhs, Rhs.stringof, rhs);
1817 return lhs < rhs ? -1 : lhs > rhs;
1854 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1857 Lhs.stringof, lhs, x, Rhs.stringof, rhs);
1859 return typeof(lhs / rhs).min; // or EXCEPTION_INT_OVERFLOW on Windows
1961 static bool hookOpEquals(L, R)(L lhs, R rhs)
1963 alias C = typeof(lhs + rhs);
1968 return hookOpEquals(rhs, lhs);
1973 auto rhs1 = C(rhs);
1974 return lhs == rhs1 && cast(R) rhs1 == rhs;
1977 return lhs == rhs;
1982 auto result = opChecked!"=="(lhs, rhs, error);
2013 static auto hookOpCmp(L, R)(L lhs, R rhs)
2015 alias C = typeof(lhs + rhs);
2018 return lhs < rhs
2020 : lhs > rhs ? C(1) : lhs == rhs ? C(0) : C.init;
2030 if (!isUnsigned!R && rhs < 0)
2033 return lhs < rhs ? -1 : lhs > rhs;
2118 Lhs hookOpCast(Lhs, Rhs)(Rhs rhs)
2122 return rhs != defaultValue!Rhs && rhs != 0;
2126 return rhs != defaultValue!Rhs ? Lhs(rhs) : defaultValue!Lhs;
2135 if (ProperCompare.hookOpCmp(rhs, Lhs.min) < 0)
2141 if (ProperCompare.hookOpCmp(rhs, Lhs.max) > 0)
2144 return cast(Lhs) rhs;
2174 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
2176 return lhs != defaultValue!Lhs && lhs == rhs;
2193 double hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
2196 return lhs < rhs
2198 : lhs > rhs ? 1.0 : lhs == rhs ? 0.0 : double.init;
2298 auto hookOpBinary(string x, L, R)(L lhs, R rhs)
2300 alias Result = typeof(lhs + rhs);
2304 auto result = opChecked!x(lhs, rhs, error);
2337 auto hookOpBinaryRight(string x, L, R)(L lhs, R rhs)
2339 alias Result = typeof(lhs + rhs);
2340 if (rhs != defaultValue!R)
2343 auto result = opChecked!x(lhs, rhs, error);
2374 void hookOpOpAssign(string x, L, R)(ref L lhs, R rhs)
2379 auto temp = opChecked!x(lhs, rhs, error);
2580 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
2583 return rhs >= 0 ? Lhs.max : Lhs.min;
2585 return (lhs >= 0) == (rhs >= 0) ? Lhs.max : Lhs.min;
2587 return lhs > 0 || !(rhs & 1) ? Lhs.max : Lhs.min;
2589 return rhs >= 0 ? Lhs.min : Lhs.max;
2593 return rhs >= 0 ? Lhs.max : 0;
2595 return rhs >= 0 ? 0 : Lhs.max;
2667 opChecked(string x, L, R)(const L lhs, const R rhs, ref bool overflow)
2679 alias C = typeof(lhs + rhs);
2683 return lhs == rhs;
2689 if (lhs != rhs) return false;
2694 if (rhs >= 0)
2708 alias C = typeof(lhs + rhs);
2718 if (!isUnsigned!R && rhs < 0)
2724 return lhs < rhs ? -1 : lhs > rhs;
2731 if (unsigned(rhs) > 8 * Result.sizeof) goto fail;
2742 return pow(lhs, rhs, overflow);
2757 return impl(Result(lhs), Result(rhs), overflow);
2763 return impl(Result(lhs), Result(rhs), overflow);
2770 if (lhs == Result.min && rhs == -1) goto fail;
2774 return impl(Result(lhs), Result(rhs), overflow);
2781 if (lhs == Result.min && rhs == -1) goto fail;
2783 if (rhs == 0) goto fail;
2797 return subu(Result(rhs), Result(-lhs), overflow);
2801 if (rhs < 0)
2802 return subu(Result(lhs), Result(-rhs), overflow);
2804 return addu(Result(lhs), Result(rhs), overflow);
2814 if (rhs < 0)
2815 return addu(Result(lhs), Result(-rhs), overflow);
2817 return subu(Result(lhs), Result(rhs), overflow);
2827 if (rhs < 0) goto fail;
2829 return mulu(Result(lhs), Result(rhs), overflow);
2835 if (lhs < 0 || rhs == 0) goto fail;
2839 if (rhs <= 0) goto fail;
2905 auto pow(L, R)(const L lhs, const R rhs, ref bool overflow)
2908 if (rhs <= 1)
2910 if (rhs == 0) return 1;
2912 return rhs == 1
2914 : (rhs == -1 && (lhs == 1 || lhs == -1)) ? lhs : 0;
2919 typeof(lhs ^^ rhs) b = void;
2925 if (rhs & 1)
2942 if (b == -1) return (rhs & 1) ? -1 : 1;
2943 if (rhs > 63)
2949 assert((b > 1 || b < -1) && rhs > 1);
2950 return powImpl(b, cast(uint) rhs, overflow);
3021 auto onOverflow(string op, Lhs, Rhs)(Lhs lhs, Rhs rhs)
3026 T onLowerBound(Rhs, T)(Rhs rhs, T)
3029 return cast(T) rhs;
3031 T onUpperBound(Rhs, T)(Rhs rhs, T)
3034 return cast(T) rhs;
3044 auto hookOpBinary(string op, Lhs, Rhs)(Lhs lhs, Rhs rhs)
3255 bool hookOpEquals(Lhs, Rhs)(const Lhs lhs, const Rhs rhs)
3258 return lhs != rhs;
3270 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
3318 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
3332 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
3335 return ProperCompare.hookOpCmp(lhs, rhs);