Skip to content

Commit 13b9ab8

Browse files
authored
Merge pull request #4635 from JackStouffer/immutable2
[trivial] Added immutable to several variables in std.numeric
2 parents 600c32c + 897dffc commit 13b9ab8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

std/numeric.d

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public:
403403
static @property size_t dig()
404404
{
405405
auto shiftcnt = precision - ((flags&Flags.storeNormalized) != 0);
406-
auto x = (shiftcnt == 64) ? 0 : 1uL << shiftcnt;
406+
immutable x = (shiftcnt == 64) ? 0 : 1uL << shiftcnt;
407407
return cast(size_t) log10(x);
408408
}
409409

@@ -1635,7 +1635,7 @@ euclideanDistance(Range1, Range2)(Range1 a, Range2 b)
16351635
Unqual!(typeof(return)) result = 0;
16361636
for (; !a.empty; a.popFront(), b.popFront())
16371637
{
1638-
auto t = a.front - b.front;
1638+
immutable t = a.front - b.front;
16391639
result += t * t;
16401640
}
16411641
static if (!haveLen) enforce(b.empty);
@@ -1660,7 +1660,7 @@ euclideanDistance(Range1, Range2, F)(Range1 a, Range2 b, F limit)
16601660
static if (!haveLen) enforce(b.empty);
16611661
break;
16621662
}
1663-
auto t = a.front - b.front;
1663+
immutable t = a.front - b.front;
16641664
result += t * t;
16651665
if (result >= limit) break;
16661666
}
@@ -1857,14 +1857,14 @@ bool normalize(R)(R range, ElementType!(R) sum = 1)
18571857
{
18581858
if (length)
18591859
{
1860-
auto f = sum / range.length;
1860+
immutable f = sum / range.length;
18611861
foreach (ref e; range) e = f;
18621862
}
18631863
return false;
18641864
}
18651865
// The path most traveled
18661866
assert(s >= 0);
1867-
auto f = sum / s;
1867+
immutable f = sum / s;
18681868
foreach (ref e; range)
18691869
e *= f;
18701870
return true;
@@ -2600,7 +2600,7 @@ T gcd(T)(T a, T b)
26002600
}
26012601
while (b)
26022602
{
2603-
auto t = b;
2603+
immutable t = b;
26042604
b = a % b;
26052605
a = t;
26062606
}
@@ -3066,7 +3066,7 @@ public:
30663066
immutable lenNeg1 = 1.0 / buf.length;
30673067
foreach (ref elem; buf)
30683068
{
3069-
auto temp = elem.re * lenNeg1;
3069+
immutable temp = elem.re * lenNeg1;
30703070
elem.re = elem.im * lenNeg1;
30713071
elem.im = temp;
30723072
}

0 commit comments

Comments
 (0)