[libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", part 5/12.

Various changes:

test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
Change M from unsigned to int. It's compared against "int x",
and we binary_search() for it within a vector<int>.

test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
Add static_cast<unsigned> when comparing int to unsigned.

test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
Change unsigned indices to int when we're being given int as a bound.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287825 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephan T. Lavavej
2016-11-23 22:02:35 +00:00
parent ed55db243e
commit bdf8bae8bb
4 changed files with 5 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ double
I(double x, unsigned a, unsigned b)
{
double r = 0;
for (int j = a; j <= a+b-1; ++j)
for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
std::pow(1-x, a+b-1-j);
return r;

View File

@@ -34,7 +34,7 @@ double
I(double x, unsigned a, unsigned b)
{
double r = 0;
for (int j = a; j <= a+b-1; ++j)
for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
std::pow(1-x, a+b-1-j);
return r;