Skip to content

Commit 406d116

Browse files
committed
update for recent compiler
1 parent 8b2c779 commit 406d116

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

source/mir/bignum/decimal.d

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct Decimal(uint size64)
3838
void toString(C = char, W)(ref scope W w, NumericSpec spec = NumericSpec.init) const scope
3939
if(isSomeChar!C && isMutable!C)
4040
{
41+
scope C[] _buffer;
42+
if (false) w.put(_buffer);
43+
() @trusted {
4144
assert(spec.format == NumericSpec.Format.exponent || spec.format == NumericSpec.Format.human);
4245
import mir.utility: _expect;
4346
// handle special values
@@ -212,6 +215,7 @@ struct Decimal(uint size64)
212215
auto expLength = printSignedToTail(exponent, buffer0[$ - N - 16 .. $ - 16], '+');
213216
buffer[$ - ++expLength] = spec.exponentChar;
214217
w.put(buffer[$ - expLength .. $]);
218+
} ();
215219
}
216220

217221
@safe:
@@ -422,7 +426,7 @@ struct Decimal(uint size64)
422426
}
423427

424428
///
425-
ref opOpAssign(string op, size_t rhsMaxSize64)(ref const Decimal!rhsMaxSize64 rhs) @safe pure return
429+
ref opOpAssign(string op, size_t rhsMaxSize64)(ref const Decimal!rhsMaxSize64 rhs) @trusted pure return
426430
if (op == "+" || op == "-")
427431
{
428432
import mir.utility: max;
@@ -450,7 +454,7 @@ struct Decimal(uint size64)
450454

451455
///
452456
version(mir_bignum_test)
453-
@safe pure nothrow @nogc
457+
@trusted pure nothrow @nogc
454458
unittest
455459
{
456460
import mir.test: should;

source/mir/bignum/fp.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ struct Fp(uint size)
637637

638638
///
639639
Fp!(coefficientizeA + coefficientizeB) extendedMul(bool noSpecial = false, uint coefficientizeA, uint coefficientizeB)(Fp!coefficientizeA a, Fp!coefficientizeB b)
640-
@safe pure nothrow @nogc
640+
@trusted pure nothrow @nogc
641641
{
642642
import mir.bignum.fixed: extendedMul;
643643
import mir.checkedint: adds;

source/mir/bignum/integer.d

+3-3
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ struct BigInt(uint size64)
263263
}
264264

265265
///
266-
BigInt copy() @property
266+
BigInt copy() @property @trusted
267267
{
268268
BigInt ret = void;
269269
ret.sign = sign;
@@ -479,7 +479,7 @@ struct BigInt(uint size64)
479479

480480
///ditto
481481
ref powMod()(scope BigUIntView!(const size_t) exponent, scope ref const BigInt modulus)
482-
@safe pure nothrow @nogc return scope
482+
@trusted pure nothrow @nogc return scope
483483
{
484484
pragma(inline, false);
485485

@@ -654,7 +654,7 @@ struct BigInt(uint size64)
654654
remainder or quotient from the truncated division
655655
+/
656656
ref opOpAssign(string op : "*", size_t rhsSize64)(scope const ref BigInt!rhsSize64 rhs)
657-
@safe pure nothrow @nogc return
657+
@trusted pure nothrow @nogc return
658658
{
659659
BigInt!(size64 + rhsSize64) c = void;
660660
c.multiply(this, rhs);

source/mir/bignum/internal/dec2float.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ private template bigSize(T)
288288
}
289289
}
290290

291-
@optStrategy("minsize")
291+
@optStrategy("minsize") @trusted
292292
private T algorithmM(T)(scope const size_t[] coefficients, long exponent)
293293
if ((is(T == float) || is(T == double) || is(T == real)))
294294
in (coefficients.length)

source/mir/parse.d

+17-17
Original file line numberDiff line numberDiff line change
@@ -295,27 +295,27 @@ Performs `nothrow` and `@nogc` string to native type conversion.
295295
296296
Rseturns: true if success and false otherwise.
297297
+/
298-
bool fromString(T, C)(scope const(C)[] str, ref T value)
299-
if (isSomeChar!C)
298+
bool fromString(T, C)(scope const(C)[] str, ref T value) @trusted
299+
if (isSomeChar!C && isFloatingPoint!T)
300300
{
301-
static if (isFloatingPoint!T)
302-
{
303-
import mir.bignum.decimal: Decimal, DecimalExponentKey;
304-
import mir.utility: _expect;
301+
import mir.bignum.decimal: Decimal, DecimalExponentKey;
302+
import mir.utility: _expect;
305303

306-
Decimal!128 decimal = void;
307-
DecimalExponentKey key;
308-
auto ret = decimal.fromStringImpl(str, key);
309-
if (_expect(ret, true))
310-
{
311-
value = cast(T) decimal;
312-
}
313-
return ret;
314-
}
315-
else
304+
Decimal!128 decimal = void;
305+
DecimalExponentKey key;
306+
auto ret = decimal.fromStringImpl(str, key);
307+
if (_expect(ret, true))
316308
{
317-
return parse!T(str, value) && str.length == 0;
309+
value = cast(T) decimal;
318310
}
311+
return ret;
312+
}
313+
314+
/// ditto
315+
bool fromString(T, C)(scope const(C)[] str, ref T value)
316+
if (isSomeChar!C && !isFloatingPoint!T)
317+
{
318+
return parse!T(str, value) && str.length == 0;
319319
}
320320

321321
///

0 commit comments

Comments
 (0)