Skip to content

Commit 441100d

Browse files
committed
build with DIP1000
1 parent 055b25c commit 441100d

File tree

7 files changed

+45
-34
lines changed

7 files changed

+45
-34
lines changed

dub.sdl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependency "mir-core" version=">=1.1.106"
99

1010
// versions "TeslAlgoM"
1111

12-
1312
buildType "unittest" {
1413
buildOptions "unittests" "debugMode" "debugInfo"
1514
versions "mir_bignum_test" "mir_bignum_test_llv"

source/mir/appender.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ unittest
360360
Algebraic!(int, string, double) x;
361361
x = 42;
362362
auto s = x.to!string;
363-
assert(s == "42", s);
363+
assert(s == "42");
364364
x = "abc";
365365
assert(x.to!string == "abc");
366366
x = 42.0;

source/mir/bignum/decimal.d

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ struct Decimal(uint size64)
3434
///
3535
BigInt!size64 coefficient;
3636

37+
@safe:
38+
3739
///
38-
DecimalView!size_t view()
40+
DecimalView!size_t view() return scope
3941
{
4042
return typeof(return)(coefficient.sign, exponent, coefficient.view.unsigned);
4143
}
4244

4345
/// ditto
44-
DecimalView!(const size_t) view() const
46+
DecimalView!(const size_t) view() const return scope
4547
{
4648
return typeof(return)(coefficient.sign, exponent, coefficient.view.unsigned);
4749
}
@@ -393,7 +395,7 @@ struct Decimal(uint size64)
393395
/++
394396
Mir parsing supports up-to quadruple precision. The conversion error is 0 ULP for normal numbers.
395397
Subnormal numbers with an exponent greater than or equal to -512 have upper error bound equal to 1 ULP. +/
396-
T opCast(T, bool wordNormalized = true)() const
398+
T opCast(T, bool wordNormalized = true)() scope const
397399
if (isFloatingPoint!T && isMutable!T)
398400
{
399401
return view.opCast!(T, wordNormalized);
@@ -455,7 +457,7 @@ unittest
455457
DecimalExponentKey key;
456458

457459
assert(decimal.fromStringImpl("3.141592653589793378e-10", key));
458-
decimal.to!double.should == 0x1.596bf8ce7631ep-32;
460+
decimal.opCast!double.should == 0x1.596bf8ce7631ep-32;
459461
key.should == DecimalExponentKey.e;
460462
}
461463

source/mir/bignum/fixed.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ struct UInt(size_t size)
185185
import mir.bignum.low_level_view: BigUIntView;
186186

187187
///
188-
BigUIntView!size_t view() @property pure nothrow @nogc scope @safe
188+
BigUIntView!size_t view() @property pure nothrow @nogc scope return @safe
189189
{
190190
return BigUIntView!size_t(data);
191191
}
192192

193193
///
194-
BigUIntView!(const size_t) view() const @property pure nothrow @nogc scope @safe
194+
BigUIntView!(const size_t) view() const @property pure nothrow @nogc scope return @safe
195195
{
196196
return BigUIntView!(const size_t)(data);
197197
}
@@ -865,7 +865,7 @@ struct UInt(size_t size)
865865

866866
/++
867867
+/
868-
size_t ctlz() const @property
868+
size_t ctlz() const scope @property
869869
@safe pure nothrow @nogc
870870
{
871871
return view.ctlz;

source/mir/bignum/integer.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ struct BigInt(uint size64)
2828
///
2929
size_t[ulong.sizeof / size_t.sizeof * size64] data;// = void;
3030

31+
@safe:
32+
3133
///
3234
this(uint size)(UInt!size fixedInt)
3335
{

source/mir/bignum/internal/kernel.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module mir.bignum.internal.kernel;
33
import mir.bignum.internal.phobos_kernel;
44
public import mir.bignum.internal.phobos_kernel: karatsubaRequiredBuffSize, divisionRequiredBuffSize;
55

6-
private inout(uint)[] toUints()(inout ulong[] data)
6+
private inout(uint)[] toUints(return scope inout ulong[] data)
77
@trusted pure nothrow @nogc
88
{
99
auto ret = cast(typeof(return)) data;

source/mir/bignum/low_level_view.d

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)