Skip to content

Commit c883b7c

Browse files
committed
simplify DecimalView
1 parent 524ed5e commit c883b7c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

source/mir/bignum/low_level_view.d

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,13 +2460,13 @@ enum DecimalExponentKey
24602460

24612461
/++
24622462
+/
2463-
struct DecimalView(W, WordEndian endian = TargetEndian, Exp = long)
2463+
struct DecimalView(W, WordEndian endian = TargetEndian)
24642464
if (isUnsigned!W)
24652465
{
24662466
///
24672467
bool sign;
24682468
///
2469-
Exp exponent;
2469+
long exponent;
24702470
///
24712471
BigUIntView!(W, endian) coefficient;
24722472

@@ -2745,7 +2745,7 @@ struct DecimalView(W, WordEndian endian = TargetEndian, Exp = long)
27452745
}
27462746

27472747
///
2748-
DecimalView!(const W, endian, Exp) lightConst()()
2748+
DecimalView!(const W, endian) lightConst()()
27492749
const @safe pure nothrow @nogc @property
27502750
{
27512751
return typeof(return)(sign, exponent, coefficient.lightConst);
@@ -2799,7 +2799,7 @@ struct DecimalView(W, WordEndian endian = TargetEndian, Exp = long)
27992799

28002800
static if (T.mant_dig < 64)
28012801
{
2802-
Fp!64 load(Exp e)
2802+
Fp!64 load(long e)
28032803
{
28042804
auto p10coeff = p10_coefficients[cast(sizediff_t)e - min_p10_e][0];
28052805
auto p10exp = p10_exponents[cast(sizediff_t)e - min_p10_e];
@@ -2840,7 +2840,7 @@ struct DecimalView(W, WordEndian endian = TargetEndian, Exp = long)
28402840
enum P = 1 << S;
28412841
static assert(min_p10_e <= -P);
28422842
static assert(max_p10_e >= P);
2843-
Fp!128 load(Exp e)
2843+
Fp!128 load(long e)
28442844
{
28452845
auto idx = cast(sizediff_t)e - min_p10_e;
28462846
ulong h = p10_coefficients[idx][0];
@@ -2857,14 +2857,14 @@ struct DecimalView(W, WordEndian endian = TargetEndian, Exp = long)
28572857

28582858
{
28592859
auto expSign = exponent < 0;
2860-
Unsigned!Exp exp = exponent;
2860+
ulong exp = exponent;
28612861
exp = expSign ? -exp : exp;
28622862
if (exp >= 5000)
28632863
{
28642864
ret = expSign ? 0 : T.infinity;
28652865
goto R;
28662866
}
2867-
Exp index = exp & 0x1FF;
2867+
long index = exp & 0x1FF;
28682868
bool gotoAlgoR;
28692869
auto c = load(expSign ? -index : index);
28702870
{
@@ -3301,17 +3301,17 @@ unittest
33013301

33023302
/++
33033303
+/
3304-
struct BinaryView(W, WordEndian endian = TargetEndian, Exp = int)
3304+
struct BinaryView(W, WordEndian endian = TargetEndian)
33053305
{
33063306
///
33073307
bool sign;
33083308
///
3309-
Exp exponent;
3309+
long exponent;
33103310
///
33113311
BigUIntView!(W, endian) coefficient;
33123312

33133313
///
3314-
DecimalView!(const W, endian, Exp) lightConst()()
3314+
DecimalView!(const W, endian) lightConst()()
33153315
const @safe pure nothrow @nogc @property
33163316
{
33173317
return typeof(return)(sign, exponent, coefficient.lightConst);

0 commit comments

Comments
 (0)