Skip to content

Commit 6129793

Browse files
committed
Merge branch 'symmetry-msvc-warnings' into 'v80-bugfix'
reduce MSVC warnings on symmetry code See merge request integer/scip!3246
2 parents bbc8cb5 + 08ddf67 commit 6129793

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/scip/prop_symmetry.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -3957,8 +3957,9 @@ SCIP_RETCODE addWeakSBCsSubgroup(
39573957
{
39583958
/* add element from lexorder to hashmap.
39593959
* Use insert, as duplicate entries in lexorder is not permitted. */
3960-
assert( ! SCIPhashmapExists(varsinlexorder, (void*) (long) (*lexorder)[k]) ); /* Use int as pointer */
3961-
SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (long) (*lexorder)[k], k) );
3960+
assert((*lexorder)[k] >= 0);
3961+
assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) (*lexorder)[k]) ); /* Use int as pointer */
3962+
SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (size_t) (*lexorder)[k], k) );
39623963
}
39633964
}
39643965

@@ -3979,6 +3980,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
39793980
graphcomp = chosencomppercolor[j];
39803981
graphcompsize = graphcompbegins[graphcomp+1] - graphcompbegins[graphcomp];
39813982
varidx = firstvaridxpercolor[j];
3983+
assert(varidx >= 0);
39823984

39833985
/* if the first variable was already contained in another orbit or if there are no variables left anyway, skip the
39843986
* component */
@@ -3987,7 +3989,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
39873989

39883990
/* If varidx is in lexorder, then it must be the first entry of lexorder. */
39893991
if ( varsinlexorder != NULL
3990-
&& SCIPhashmapExists(varsinlexorder, (void*) (long) varidx)
3992+
&& SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx)
39913993
&& lexorder != NULL && *lexorder != NULL && *maxnvarsorder > 0 && *nvarsorder > 0
39923994
&& (*lexorder)[0] != varidx )
39933995
continue;
@@ -4077,6 +4079,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
40774079
int varidx;
40784080

40794081
varidx = orbit[activeorb][0];
4082+
assert(varidx >= 0);
40804083

40814084
if ( *maxnvarsorder == 0 )
40824085
{
@@ -4097,13 +4100,13 @@ SCIP_RETCODE addWeakSBCsSubgroup(
40974100
if ( varidx == (*lexorder)[0] )
40984101
{
40994102
/* lexorder is already ok!! */
4100-
assert( SCIPhashmapExists(varsinlexorder, (void*) (long) varidx) );
4103+
assert( SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx) );
41014104
}
41024105
else
41034106
{
41044107
/* Then varidx must not be in the lexorder,
41054108
* We must add it at the front of the array, and maintain the current order. */
4106-
assert( ! SCIPhashmapExists(varsinlexorder, (void*) (long) varidx) );
4109+
assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx) );
41074110

41084111
++(*maxnvarsorder);
41094112
++(*nvarsorder);

src/symmetry/compute_symmetry_sassy.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#ifdef _MSC_VER
4747
# pragma warning(push)
4848
# pragma warning(disable: 4189) // local variable is initialized but not referenced
49+
# pragma warning(disable: 4267) // conversion of size_t to int (at sassy/preprocessor.h:2897)
4950
# pragma warning(disable: 4388) // compare signed and unsigned expression
5051
# pragma warning(disable: 4456) // shadowed variable
5152
# pragma warning(disable: 4430) // missing type specifier

0 commit comments

Comments
 (0)