Skip to content

Commit 11b4c1f

Browse files
committed
fix weird compiler error of std.numeric.entropy
1 parent f14f0df commit 11b4c1f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ script:
3131
# test code coverage
3232
- (cd dmd && make -f posix.mak)
3333
- (cd druntime && make -f posix.mak)
34-
- (cd phobos && make -f posix.mak $(find std etc -name "*.d" | sed "s/[.]d$/.test/" | grep -vE '(std.encoding|net.curl)' ))
34+
- (cd phobos && make -f posix.mak $(find std etc -name "*.d" | sed "s/[.]d$/.test/" | grep -vE '(std.algorithm.sorting|std.encoding|net.curl)' ))
3535
after_success:
3636
- (cd phobos && bash <(curl -s https://codecov.io/bash))

std/numeric.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,10 @@ result is greater than or equal to $(D max).
19231923
ElementType!Range entropy(Range)(Range r) if (isInputRange!Range)
19241924
{
19251925
Unqual!(typeof(return)) result = 0.0;
1926-
foreach (e; r)
1926+
for (;!r.empty; r.popFront)
19271927
{
1928-
if (!e) continue;
1929-
result -= e * log2(e);
1928+
if (!r.front) continue;
1929+
result -= r.front * log2(r.front);
19301930
}
19311931
return result;
19321932
}
@@ -1937,10 +1937,10 @@ if (isInputRange!Range &&
19371937
!is(CommonType!(ElementType!Range, F) == void))
19381938
{
19391939
Unqual!(typeof(return)) result = 0.0;
1940-
foreach (e; r)
1940+
for (;!r.empty; r.popFront)
19411941
{
1942-
if (!e) continue;
1943-
result -= e * log2(e);
1942+
if (!r.front) continue;
1943+
result -= r.front * log2(r.front);
19441944
if (result >= max) break;
19451945
}
19461946
return result;

0 commit comments

Comments
 (0)