Skip to content

Commit 897dffc

Browse files
committed
Added immutable to several variables in std.numeric
1 parent 8dbad58 commit 897dffc

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

@@ -1631,7 +1631,7 @@ euclideanDistance(Range1, Range2)(Range1 a, Range2 b)
16311631
Unqual!(typeof(return)) result = 0;
16321632
for (; !a.empty; a.popFront(), b.popFront())
16331633
{
1634-
auto t = a.front - b.front;
1634+
immutable t = a.front - b.front;
16351635
result += t * t;
16361636
}
16371637
static if (!haveLen) enforce(b.empty);
@@ -1654,7 +1654,7 @@ euclideanDistance(Range1, Range2, F)(Range1 a, Range2 b, F limit)
16541654
static if (!haveLen) enforce(b.empty);
16551655
break;
16561656
}
1657-
auto t = a.front - b.front;
1657+
immutable t = a.front - b.front;
16581658
result += t * t;
16591659
if (result >= limit) break;
16601660
}
@@ -1846,14 +1846,14 @@ bool normalize(R)(R range, ElementType!(R) sum = 1)
18461846
{
18471847
if (length)
18481848
{
1849-
auto f = sum / range.length;
1849+
immutable f = sum / range.length;
18501850
foreach (ref e; range) e = f;
18511851
}
18521852
return false;
18531853
}
18541854
// The path most traveled
18551855
assert(s >= 0);
1856-
auto f = sum / s;
1856+
immutable f = sum / s;
18571857
foreach (ref e; range)
18581858
e *= f;
18591859
return true;
@@ -2580,7 +2580,7 @@ T gcd(T)(T a, T b)
25802580
}
25812581
while (b)
25822582
{
2583-
auto t = b;
2583+
immutable t = b;
25842584
b = a % b;
25852585
a = t;
25862586
}
@@ -3043,7 +3043,7 @@ public:
30433043
immutable lenNeg1 = 1.0 / buf.length;
30443044
foreach (ref elem; buf)
30453045
{
3046-
auto temp = elem.re * lenNeg1;
3046+
immutable temp = elem.re * lenNeg1;
30473047
elem.re = elem.im * lenNeg1;
30483048
elem.im = temp;
30493049
}

0 commit comments

Comments
 (0)