[Lemon-commits] Alpar Juttner: Resolve MSVC conversion warnings ...
Lemon HG
hg at lemon.cs.elte.hu
Thu Apr 2 13:38:34 CEST 2015
details: http://lemon.cs.elte.hu/hg/lemon/rev/d51126dc39fa
changeset: 1328:d51126dc39fa
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Thu Apr 02 13:36:16 2015 +0200
description:
Resolve MSVC conversion warnings C4244 (#519)
diffstat:
lemon/elevator.h | 6 +++---
lemon/radix_sort.h | 2 +-
lemon/random.h | 4 ++--
lemon/static_graph.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diffs (72 lines):
diff --git a/lemon/elevator.h b/lemon/elevator.h
--- a/lemon/elevator.h
+++ b/lemon/elevator.h
@@ -167,7 +167,7 @@
///Return the number of items on level \c l.
int onLevel(int l) const
{
- return _first[l+1]-_first[l];
+ return static_cast<int>(_first[l+1]-_first[l]);
}
///Return true if level \c l is empty.
bool emptyLevel(int l) const
@@ -177,12 +177,12 @@
///Return the number of items above level \c l.
int aboveLevel(int l) const
{
- return _first[_max_level+1]-_first[l+1];
+ return static_cast<int>(_first[_max_level+1]-_first[l+1]);
}
///Return the number of active items on level \c l.
int activesOnLevel(int l) const
{
- return _last_active[l]-_first[l]+1;
+ return static_cast<int>(_last_active[l]-_first[l]+1);
}
///Return true if there is no active item on level \c l.
bool activeFree(int l) const
diff --git a/lemon/radix_sort.h b/lemon/radix_sort.h
--- a/lemon/radix_sort.h
+++ b/lemon/radix_sort.h
@@ -328,7 +328,7 @@
typedef std::allocator<Key> Allocator;
Allocator allocator;
- int length = std::distance(first, last);
+ int length = static_cast<int>(std::distance(first, last));
Key* buffer = allocator.allocate(2 * length);
try {
bool dir = true;
diff --git a/lemon/random.h b/lemon/random.h
--- a/lemon/random.h
+++ b/lemon/random.h
@@ -199,7 +199,7 @@
initState(init);
- num = length > end - begin ? length : end - begin;
+ num = static_cast<int>(length > end - begin ? length : end - begin);
while (num--) {
curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
+ *it + cnt;
@@ -213,7 +213,7 @@
--curr;
}
- num = length - 1; cnt = length - (curr - state) - 1;
+ num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
while (num--) {
curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
- cnt;
diff --git a/lemon/static_graph.h b/lemon/static_graph.h
--- a/lemon/static_graph.h
+++ b/lemon/static_graph.h
@@ -203,7 +203,7 @@
built = true;
node_num = n;
- arc_num = std::distance(first, last);
+ arc_num = static_cast<int>(std::distance(first, last));
node_first_out = new int[node_num + 1];
node_first_in = new int[node_num];
More information about the Lemon-commits
mailing list