Skip to content

Commit 788c13c

Browse files
committed
Merge branch '3726-msvc-compiler-warnings-on-hypergraph-code' into 'master'
Resolve "MSVC compiler warnings on hypergraph code" Closes #3726 See merge request integer/scip!3461
2 parents 422549f + 612a447 commit 788c13c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/scip/hypergraph.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,17 +457,17 @@ SCIP_DECL_HASHGETKEY(overlapHashGetKey)
457457
static
458458
SCIP_DECL_HASHKEYEQ(overlapHashKeyEqPtr)
459459
{
460-
long o1;
461-
long o2;
460+
size_t o1;
461+
size_t o2;
462462
SCIP_HYPERGRAPH* hypergraph;
463463
int begin1;
464464
int beyond1;
465465
int begin2;
466466
int beyond2;
467467
int i2;
468468

469-
o1 = (long)key1 - 1;
470-
o2 = (long)key2 - 1;
469+
o1 = (size_t)key1 - 1;
470+
o2 = (size_t)key2 - 1;
471471
hypergraph = (SCIP_HYPERGRAPH*) userptr;
472472
begin1 = hypergraph->overlapsverticesbeg[o1];
473473
beyond1 = hypergraph->overlapsverticesbeg[o1 + 1];
@@ -492,14 +492,14 @@ SCIP_DECL_HASHKEYEQ(overlapHashKeyEqPtr)
492492
static
493493
SCIP_DECL_HASHKEYVAL(overlapHashKeyValPtr)
494494
{
495-
long o;
495+
size_t o;
496496
SCIP_HYPERGRAPH* hypergraph;
497497
int begin;
498498
int beyond;
499499
int i;
500500
uint32_t hash;
501501

502-
o = (long)key - 1;
502+
o = (size_t)key - 1;
503503
hypergraph = (SCIP_HYPERGRAPH*) userptr;
504504
begin = hypergraph->overlapsverticesbeg[o];
505505
beyond = hypergraph->overlapsverticesbeg[o + 1];
@@ -534,6 +534,7 @@ SCIP_RETCODE findOverlap(
534534
int first;
535535
int beyond;
536536
void* element;
537+
size_t nextoverlap;
537538

538539
assert(hypergraph);
539540
assert(nvertices > 0);
@@ -550,16 +551,17 @@ SCIP_RETCODE findOverlap(
550551
hypergraph->overlapsvertices[first + i] = vertices[i];
551552
hypergraph->overlapsverticesbeg[hypergraph->noverlaps + 1] = beyond;
552553

553-
element = SCIPhashtableRetrieve(hypergraph->overlaphashtable, (void*) (hypergraph->noverlaps + 1UL));
554+
nextoverlap = (size_t) hypergraph->noverlaps + 1UL; /*lint !e571 */
555+
element = SCIPhashtableRetrieve(hypergraph->overlaphashtable, (void*) nextoverlap);
554556
if( element != NULL )
555557
{
556-
*poverlap = (long) element - 1; /*lint !e712*/
558+
*poverlap = (size_t)element - 1; /*lint !e712*/
557559
if( padded )
558560
*padded = FALSE;
559561
}
560562
else if( add )
561563
{
562-
SCIP_CALL_ABORT( SCIPhashtableInsert(hypergraph->overlaphashtable, (void*) (hypergraph->noverlaps + 1UL)) );
564+
SCIP_CALL_ABORT( SCIPhashtableInsert(hypergraph->overlaphashtable, (void*) nextoverlap) );
563565

564566
*poverlap = hypergraph->noverlaps;
565567
hypergraph->noverlaps++;

0 commit comments

Comments
 (0)