# HG changeset patch # User Alpar Juttner # Date 1427974576 -7200 # Node ID d51126dc39fa518a6a872da52f1ab92b16f44459 # Parent 18c89646185e42f046d9babee467cf347ebccaaf Resolve MSVC conversion warnings C4244 (#519) diff -r 18c89646185e -r d51126dc39fa lemon/elevator.h --- a/lemon/elevator.h Thu Apr 02 12:57:18 2015 +0200 +++ b/lemon/elevator.h Thu Apr 02 13:36:16 2015 +0200 @@ -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(_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(_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(_last_active[l]-_first[l]+1); } ///Return true if there is no active item on level \c l. bool activeFree(int l) const diff -r 18c89646185e -r d51126dc39fa lemon/radix_sort.h --- a/lemon/radix_sort.h Thu Apr 02 12:57:18 2015 +0200 +++ b/lemon/radix_sort.h Thu Apr 02 13:36:16 2015 +0200 @@ -328,7 +328,7 @@ typedef std::allocator Allocator; Allocator allocator; - int length = std::distance(first, last); + int length = static_cast(std::distance(first, last)); Key* buffer = allocator.allocate(2 * length); try { bool dir = true; diff -r 18c89646185e -r d51126dc39fa lemon/random.h --- a/lemon/random.h Thu Apr 02 12:57:18 2015 +0200 +++ b/lemon/random.h Thu Apr 02 13:36:16 2015 +0200 @@ -199,7 +199,7 @@ initState(init); - num = length > end - begin ? length : end - begin; + num = static_cast(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(length - (curr - state) - 1); while (num--) { curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2)) - cnt; diff -r 18c89646185e -r d51126dc39fa lemon/static_graph.h --- a/lemon/static_graph.h Thu Apr 02 12:57:18 2015 +0200 +++ b/lemon/static_graph.h Thu Apr 02 13:36:16 2015 +0200 @@ -203,7 +203,7 @@ built = true; node_num = n; - arc_num = std::distance(first, last); + arc_num = static_cast(std::distance(first, last)); node_first_out = new int[node_num + 1]; node_first_in = new int[node_num];