Lines Matching refs:rhs

286     this(U)(U rhs)
288 !isIntegral!T && is(typeof(T(rhs))) ||
290 is(typeof(Checked!(T, Hook)(rhs.get))))
293 payload = rhs;
295 payload = rhs.payload;
309 void opAssign(U)(U rhs) if (is(typeof(Checked!(T, Hook)(rhs))))
312 payload = rhs;
314 payload = rhs.payload;
400 bool opEquals(U, this _)(U rhs)
402 is(U == Checked!(V, W), V, W) && is(typeof(this == rhs.payload)))
406 alias R = typeof(payload + rhs.payload);
410 return this == rhs.payload;
414 return payload == rhs.payload;
418 return hook.hookOpEquals(payload, rhs.payload);
422 return rhs.hook.hookOpEquals(rhs.payload, payload);
426 return payload == rhs.payload;
430 return hook.hookOpEquals(payload, rhs);
432 return payload == rhs;
441 static bool hookOpEquals(L, R)(L lhs, R rhs) in hookOpEquals()
443 if (lhs != rhs) return false; in hookOpEquals()
446 if (lhs > 0 && rhs < 0) thereWereErrors = true; in hookOpEquals()
449 if (lhs < 0 && rhs > 0) thereWereErrors = true; in hookOpEquals()
462 static bool hookOpEquals(L, R)(L lhs, R rhs) in hookOpEquals()
464 return lhs == rhs; in hookOpEquals()
485 auto opCmp(U, this _)(const U rhs) //const pure @safe nothrow @nogc
490 return hook.hookOpCmp(payload, rhs);
494 return payload < rhs ? -1 : payload > rhs;
499 return lhs < rhs ? U(-1.0)
500 : lhs > rhs ? U(1.0)
501 : lhs == rhs ? U(0.0) : U.init;
505 return payload < rhs ? -1 : payload > rhs;
510 auto opCmp(U, Hook1, this _)(Checked!(U, Hook1) rhs) in opCmp()
512 alias R = typeof(payload + rhs.payload); in opCmp()
515 return payload < rhs.payload ? -1 : payload > rhs.payload; in opCmp()
520 return this.opCmp(rhs.payload); in opCmp()
524 return hook.hookOpCmp(get, rhs.get); in opCmp()
528 return -rhs.hook.hookOpCmp(rhs.payload, get); in opCmp()
532 return payload < rhs.payload ? -1 : payload > rhs.payload; in opCmp()
542 static int hookOpCmp(L, R)(L lhs, R rhs) in hookOpCmp()
546 if (rhs < 0 && rhs >= lhs) in hookOpCmp()
551 if (lhs < 0 && lhs >= rhs) in hookOpCmp()
555 return lhs < rhs ? -1 : lhs > rhs; in hookOpCmp()
563 static int hookOpCmp(L, R)(L lhs, R rhs) in hookOpCmp()
566 return lhs < rhs ? -1 : lhs > rhs; in hookOpCmp()
693 auto opBinary(string op, Rhs)(const Rhs rhs)
696 return opBinaryImpl!(op, Rhs, typeof(this))(rhs);
700 auto opBinary(string op, Rhs)(const Rhs rhs) const
703 return opBinaryImpl!(op, Rhs, typeof(this))(rhs);
706 private auto opBinaryImpl(string op, Rhs, this _)(const Rhs rhs)
715 auto r = hook.hookOpBinary!op(payload, rhs);
729 auto r = opChecked!op(payload, rhs, overflow);
730 if (overflow) r = hook.onOverflow!op(payload, rhs);
741 auto opBinary(string op, U, Hook1)(Checked!(U, Hook1) rhs)
743 return opBinaryImpl2!(op, U, Hook1, typeof(this))(rhs);
747 auto opBinary(string op, U, Hook1)(Checked!(U, Hook1) rhs) const
749 return opBinaryImpl2!(op, U, Hook1, typeof(this))(rhs);
753 auto opBinaryImpl2(string op, U, Hook1, this _)(Checked!(U, Hook1) rhs)
755 alias R = typeof(get + rhs.payload);
764 return hook.hookOpBinary!op(payload, rhs);
801 static auto hookOpBinary(string x, L, R)(L lhs, R rhs)
874 static auto hookOpBinaryRight(string x, L, R)(L lhs, R rhs)
916 ref Checked opOpAssign(string op, Rhs)(const Rhs rhs) return
923 hook.hookOpOpAssign!op(payload, rhs);
927 alias R = typeof(get + rhs);
928 auto r = opBinary!op(rhs).get;
962 static T onLowerBound(Rhs, T)(Rhs rhs, T bound)
967 static T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1061 T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1063 Warn.onLowerBound(rhs, bound);
1067 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1069 Warn.onUpperBound(rhs, bound);
1089 static bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1092 auto result = opChecked!"=="(lhs, rhs, error);
1095 Warn.hookOpEquals(lhs, rhs);
1121 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1124 auto result = opChecked!"cmp"(lhs, rhs, error);
1127 Warn.hookOpCmp(lhs, rhs);
1153 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1155 Warn.onOverflow!x(lhs, rhs);
1232 static T onLowerBound(Rhs, T)(Rhs rhs, T bound)
1235 Rhs.stringof, rhs, T.stringof, bound);
1238 static T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1241 Rhs.stringof, rhs, T.stringof, bound);
1260 static bool hookOpEquals(L, R)(L lhs, R rhs)
1263 auto result = opChecked!"=="(lhs, rhs, error);
1267 L.stringof, lhs, R.stringof, rhs);
1293 static int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1296 auto result = opChecked!"cmp"(lhs, rhs, error);
1300 Lhs.stringof, lhs, Rhs.stringof, rhs);
1325 static typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1328 Lhs.stringof, lhs, x, Rhs.stringof, rhs);
1403 Lhs onLowerBound(Rhs, T)(Rhs rhs, T bound)
1406 Rhs.stringof, rhs, T.stringof, bound);
1407 return cast(T) rhs;
1410 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
1413 Rhs.stringof, rhs, T.stringof, bound);
1414 return cast(T) rhs;
1433 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1436 auto result = opChecked!"=="(lhs, rhs, error);
1440 Lhs.stringof, lhs, Rhs.stringof, rhs);
1441 return lhs == rhs;
1472 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1475 auto result = opChecked!"cmp"(lhs, rhs, error);
1479 Lhs.stringof, lhs, Rhs.stringof, rhs);
1480 return lhs < rhs ? -1 : lhs > rhs;
1516 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
1519 Lhs.stringof, lhs, x, Rhs.stringof, rhs);
1571 static bool hookOpEquals(L, R)(L lhs, R rhs)
1573 alias C = typeof(lhs + rhs);
1578 return hookOpEquals(rhs, lhs);
1583 auto rhs1 = C(rhs);
1584 return lhs == rhs1 && cast(R) rhs1 == rhs;
1587 return lhs == rhs;
1592 auto result = opChecked!"=="(lhs, rhs, error);
1623 static auto hookOpCmp(L, R)(L lhs, R rhs)
1625 alias C = typeof(lhs + rhs);
1628 return lhs < rhs
1630 : lhs > rhs ? C(1) : lhs == rhs ? C(0) : C.init;
1640 if (!isUnsigned!R && rhs < 0)
1643 return lhs < rhs ? -1 : lhs > rhs;
1728 Lhs hookOpCast(Lhs, Rhs)(Rhs rhs)
1732 return rhs != defaultValue!Rhs && rhs != 0;
1736 return rhs != defaultValue!Rhs ? Lhs(rhs) : defaultValue!Lhs;
1745 if (ProperCompare.hookOpCmp(rhs, Lhs.min) < 0)
1751 if (ProperCompare.hookOpCmp(rhs, Lhs.max) > 0)
1754 return cast(Lhs) rhs;
1784 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1786 return lhs != defaultValue!Lhs && lhs == rhs;
1803 double hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
1806 return lhs < rhs
1808 : lhs > rhs ? 1.0 : lhs == rhs ? 0.0 : double.init;
1908 auto hookOpBinary(string x, L, R)(L lhs, R rhs)
1910 alias Result = typeof(lhs + rhs);
1914 auto result = opChecked!x(lhs, rhs, error);
1947 auto hookOpBinaryRight(string x, L, R)(L lhs, R rhs)
1949 alias Result = typeof(lhs + rhs);
1950 if (rhs != defaultValue!R)
1953 auto result = opChecked!x(lhs, rhs, error);
1984 void hookOpOpAssign(string x, L, R)(ref L lhs, R rhs)
1989 auto temp = opChecked!x(lhs, rhs, error);
2140 T onLowerBound(Rhs, T)(Rhs rhs, T bound)
2145 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
2188 typeof(Lhs() + Rhs()) onOverflow(string x, Lhs, Rhs)(Lhs lhs, Rhs rhs)
2191 return rhs >= 0 ? Lhs.max : Lhs.min;
2193 return (lhs >= 0) == (rhs >= 0) ? Lhs.max : Lhs.min;
2195 return lhs > 0 || !(rhs & 1) ? Lhs.max : Lhs.min;
2197 return rhs >= 0 ? Lhs.min : Lhs.max;
2201 return rhs >= 0 ? Lhs.max : 0;
2203 return rhs >= 0 ? 0 : Lhs.max;
2275 opChecked(string x, L, R)(const L lhs, const R rhs, ref bool overflow)
2287 alias C = typeof(lhs + rhs);
2291 return lhs == rhs;
2297 if (lhs != rhs) return false;
2302 if (rhs >= 0)
2316 alias C = typeof(lhs + rhs);
2326 if (!isUnsigned!R && rhs < 0)
2332 return lhs < rhs ? -1 : lhs > rhs;
2339 if (unsigned(rhs) > 8 * Result.sizeof) goto fail;
2350 return pow(lhs, rhs, overflow);
2365 return impl(Result(lhs), Result(rhs), overflow);
2371 return impl(Result(lhs), Result(rhs), overflow);
2378 if (lhs == Result.min && rhs == -1) goto fail;
2382 return impl(Result(lhs), Result(rhs), overflow);
2389 if (lhs == Result.min && rhs == -1) goto fail;
2391 if (rhs == 0) goto fail;
2405 return subu(Result(rhs), Result(-lhs), overflow);
2409 if (rhs < 0)
2410 return subu(Result(lhs), Result(-rhs), overflow);
2412 return addu(Result(lhs), Result(rhs), overflow);
2422 if (rhs < 0)
2423 return addu(Result(lhs), Result(-rhs), overflow);
2425 return subu(Result(lhs), Result(rhs), overflow);
2435 if (rhs < 0) goto fail;
2437 return mulu(Result(lhs), Result(rhs), overflow);
2443 if (lhs < 0 || rhs == 0) goto fail;
2447 if (rhs <= 0) goto fail;
2513 auto pow(L, R)(const L lhs, const R rhs, ref bool overflow)
2516 if (rhs <= 1)
2518 if (rhs == 0) return 1;
2520 return rhs == 1
2522 : (rhs == -1 && (lhs == 1 || lhs == -1)) ? lhs : 0;
2527 typeof(lhs ^^ rhs) b = void;
2533 if (rhs & 1)
2550 if (b == -1) return (rhs & 1) ? -1 : 1;
2551 if (rhs > 63)
2557 assert((b > 1 || b < -1) && rhs > 1);
2558 return powImpl(b, cast(uint) rhs, overflow);
2629 auto onOverflow(string op, Lhs, Rhs)(Lhs lhs, Rhs rhs)
2634 T onLowerBound(Rhs, T)(Rhs rhs, T bound)
2637 return cast(T) rhs;
2639 T onUpperBound(Rhs, T)(Rhs rhs, T bound)
2642 return cast(T) rhs;
2649 auto hookOpBinary(string op, Lhs, Rhs)(Lhs lhs, Rhs rhs)
2864 bool hookOpEquals(Lhs, Rhs)(const Lhs lhs, const Rhs rhs)
2867 return lhs != rhs;
2879 bool hookOpEquals(Lhs, Rhs)(Lhs lhs, Rhs rhs)
2927 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
2941 int hookOpCmp(Lhs, Rhs)(Lhs lhs, Rhs rhs)
2944 return ProperCompare.hookOpCmp(lhs, rhs);