@@ -78,6 +78,8 @@ struct BigUIntView(W)
7878 +/
7979 W[] coefficients;
8080
81+ @safe :
82+
8183 /+ +
8284 Retrurns: signed integer view using the same data payload
8385 +/
@@ -89,14 +91,14 @@ struct BigUIntView(W)
8991 /+ +
9092 Retrurns: signed integer view using the same data payload
9193 +/
92- BigIntView! W signed ()(bool sign = false ) @safe pure nothrow @nogc scope @property
94+ BigIntView! W signed ()(bool sign = false ) @safe pure nothrow @nogc return @property
9395 {
9496 return typeof (return )(this , sign);
9597 }
9698
9799 static if (W.sizeof >= size_t .sizeof)
98100 // /
99- T opCast (T)() const
101+ T opCast (T)() const scope
100102 if (isFloatingPoint! T && isMutable! T)
101103 {
102104 import mir.bignum.internal.dec2float: binaryTo;
@@ -106,7 +108,7 @@ struct BigUIntView(W)
106108 static if (W.sizeof >= size_t .sizeof)
107109 // /
108110 @safe
109- T opCast (T : Fp! coefficientSize, uint coefficientSize)() const
111+ T opCast (T : Fp! coefficientSize, uint coefficientSize)() const scope
110112 {
111113 static if (isMutable! W)
112114 {
@@ -159,21 +161,21 @@ struct BigUIntView(W)
159161
160162 // /
161163 pure nothrow @nogc
162- BigUIntView! V opCast (T : BigUIntView! V, V)()
164+ BigUIntView! V opCast (T : BigUIntView! V, V)() return scope
163165 if (V.sizeof <= W.sizeof)
164166 {
165167 return typeof (return )(cast (V[])this .coefficients);
166168 }
167169
168170 pure nothrow @nogc
169- BigUIntView! V opCast (T : BigUIntView! V, V)() const
171+ BigUIntView! V opCast (T : BigUIntView! V, V)() const return scope
170172 if (V.sizeof <= W.sizeof)
171173 {
172174 return typeof (return )(cast (V[])this .coefficients);
173175 }
174176
175177 // /
176- BigUIntView! (const W) lightConst()()
178+ BigUIntView! (const W) lightConst()() return scope
177179 const @safe pure nothrow @nogc @property
178180 {
179181 return typeof (return )(coefficients);
@@ -183,7 +185,7 @@ struct BigUIntView(W)
183185
184186 /+ +
185187 +/
186- sizediff_t opCmp (BigUIntView! (const W) rhs)
188+ sizediff_t opCmp (scope BigUIntView! (const W) rhs)
187189 const @safe pure nothrow @nogc scope
188190 {
189191 import mir.algorithm.iteration: cmp;
@@ -567,7 +569,7 @@ struct BigUIntView(W)
567569 Returns:
568570 true in case of unsigned overflow
569571 +/
570- bool opOpAssign (string op)(BigUIntView! (const W) rhs, bool overflow = false )
572+ bool opOpAssign (string op)(scope BigUIntView! (const W) rhs, bool overflow = false )
571573 @safe pure nothrow @nogc scope
572574 if (op == " +" || op == " -" )
573575 {
@@ -793,7 +795,7 @@ struct BigUIntView(W)
793795 /+ +
794796 Strips most significant zero coefficients.
795797 +/
796- BigUIntView normalized ()
798+ BigUIntView normalized () return scope
797799 {
798800 auto number = this ;
799801 if (number.coefficients.length) do
@@ -807,7 +809,7 @@ struct BigUIntView(W)
807809 }
808810
809811 // /ditto
810- BigUIntView! (const W) normalized() const
812+ BigUIntView! (const W) normalized() const return scope
811813 {
812814 return lightConst.normalized;
813815 }
@@ -823,7 +825,7 @@ struct BigUIntView(W)
823825
824826 /+ +
825827 +/
826- size_t ctlz ()() const @property
828+ size_t ctlz ()() scope const @property
827829 @safe pure nothrow @nogc
828830 {
829831 import mir.bitop: ctlz;
@@ -846,7 +848,7 @@ struct BigUIntView(W)
846848
847849 /+ +
848850 +/
849- size_t cttz ()() const @property
851+ size_t cttz ()() scope const @property
850852 @safe pure nothrow @nogc
851853 in (coefficients.length)
852854 {
@@ -868,7 +870,7 @@ struct BigUIntView(W)
868870 }
869871
870872 // /
871- BigIntView! W withSign ()(bool sign)
873+ BigIntView! W withSign ()(bool sign) return scope
872874 {
873875 return typeof (return )(this , sign);
874876 }
@@ -1267,6 +1269,8 @@ struct BigIntView(W)
12671269 +/
12681270 bool sign;
12691271
1272+ @safe :
1273+
12701274 // /
12711275 inout (W)[] coefficients () inout @property
12721276 {
@@ -1412,7 +1416,7 @@ struct BigIntView(W)
14121416 }
14131417
14141418 // /
1415- T opCast (T)() const
1419+ T opCast (T)() const scope
14161420 if (isFloatingPoint! T && isMutable! T)
14171421 {
14181422 auto ret = this .unsigned.opCast ! T;
@@ -1422,7 +1426,7 @@ struct BigIntView(W)
14221426 }
14231427
14241428 // /
1425- T opCast (T, bool nonZero = false )() const
1429+ T opCast (T, bool nonZero = false )() const scope
14261430 if (is (T == long ) || is (T == int ))
14271431 {
14281432 auto ret = this .unsigned.opCast ! (Unsigned! T, nonZero);
@@ -1555,29 +1559,29 @@ struct BigIntView(W)
15551559
15561560 /+ +
15571561 +/
1558- T opCast (T : Fp! coefficientSize, uint coefficientSize)() const
1562+ T opCast (T : Fp! coefficientSize, uint coefficientSize)() const scope
15591563 {
15601564 auto ret = unsigned.opCast ! (Fp! coefficientSize);
15611565 ret.sign = sign;
15621566 return ret;
15631567 }
15641568
15651569 // /
1566- BigIntView! V opCast (T : BigIntView! V, V)()
1570+ BigIntView! V opCast (T : BigIntView! V, V)() return scope
15671571 if (V.sizeof <= W.sizeof)
15681572 {
15691573 return typeof (return )(this .unsigned.opCast ! (BigUIntView! V), sign);
15701574 }
15711575
15721576 // /
1573- BigIntView! V opCast (T : BigIntView! V, V)() const
1577+ BigIntView! V opCast (T : BigIntView! V, V)() const return scope
15741578 if (V.sizeof <= W.sizeof)
15751579 {
15761580 return typeof (return )(this .unsigned.opCast ! (BigUIntView! V), sign);
15771581 }
15781582
15791583 // /
1580- BigIntView! (const W) lightConst()()
1584+ BigIntView! (const W) lightConst()() return scope
15811585 const @safe pure nothrow @nogc @property
15821586 {
15831587 return typeof (return )(unsigned.lightConst, sign);
@@ -1783,7 +1787,7 @@ struct BigIntView(W)
17831787 Strips most significant zero coefficients.
17841788 Sets sign to zero if no coefficients were left.
17851789 +/
1786- BigIntView normalized ()
1790+ BigIntView normalized () return scope
17871791 {
17881792 auto number = this ;
17891793 number.unsigned = number.unsigned.normalized;
@@ -1792,7 +1796,7 @@ struct BigIntView(W)
17921796 }
17931797
17941798 // /ditto
1795- BigIntView! (const W) normalized() const
1799+ BigIntView! (const W) normalized() const return scope
17961800 {
17971801 return lightConst.normalized;
17981802 }
@@ -1961,6 +1965,8 @@ struct DecimalView(W)
19611965 // /
19621966 BigUIntView! W coefficient;
19631967
1968+ @safe :
1969+
19641970 static if (is (W == size_t ))
19651971 /+ +
19661972 Returns: false in case of overflow or incorrect string.
@@ -2038,7 +2044,7 @@ struct DecimalView(W)
20382044 }
20392045
20402046 // /
2041- DecimalView! (const W) lightConst()()
2047+ DecimalView! (const W) lightConst()() return scope
20422048 const @safe pure nothrow @nogc @property
20432049 {
20442050 return typeof (return )(sign, exponent, coefficient.lightConst);
@@ -2058,7 +2064,7 @@ struct DecimalView(W)
20582064 Mir parsing supports up-to quadruple precision. The conversion error is 0 ULP for normal numbers.
20592065 Subnormal numbers with an exponent greater than or equal to -512 have upper error bound equal to 1 ULP.
20602066 +/
2061- T opCast (T, bool wordNormalized = false )() const
2067+ T opCast (T, bool wordNormalized = false )() const scope
20622068 if (isFloatingPoint! T && isMutable! T)
20632069 {
20642070 import mir.bignum.internal.dec2float;
@@ -2402,8 +2408,10 @@ struct BinaryView(W)
24022408 // /
24032409 BigUIntView! W coefficient;
24042410
2411+ @safe :
2412+
24052413 // /
2406- DecimalView! (const W) lightConst()()
2414+ DecimalView! (const W) lightConst()() return scope
24072415 const @safe pure nothrow @nogc @property
24082416 {
24092417 return typeof (return )(sign, exponent, coefficient.lightConst);
0 commit comments