From 6847a46ce55b62af8dc00963fa0b95b0569fa0f5 Mon Sep 17 00:00:00 2001 From: Cris Luengo Date: Sat, 21 May 2022 14:30:42 -0600 Subject: [PATCH] Fixing some new compiler warnings in GCC 11.3. [skip ci] --- src/binary/skeleton.cpp | 54 +++++++++++++++++----------------- src/morphology/pathopening.cpp | 6 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/binary/skeleton.cpp b/src/binary/skeleton.cpp index 4ee64c13..4aa7dc59 100644 --- a/src/binary/skeleton.cpp +++ b/src/binary/skeleton.cpp @@ -745,7 +745,7 @@ void Eusk2D( pim += neigk[ dirc ][ 0 ]; if( *pim & m2 ) { *pim &= ~m2; - b.STR( pim, ( dirc - 1 ) & 15 ); + b.STR( pim, ( dirc - 1u ) & 15u ); } pim = ptemp + neigk[ dirc ][ 1 ]; if( *pim & m2 ) { @@ -778,21 +778,21 @@ void Eusk2D( // test neighbourhood in old image, use dirc to store table entry dirc = 0; pim += strideX; - if( *pim & m2 ) { dirc |= 1; } + if( *pim & m2 ) { dirc |= 1u; } pim -= strideX2; - if( *pim & m2 ) { dirc |= 16; } + if( *pim & m2 ) { dirc |= 16u; } pim -= strideY; - if( *pim & m2 ) { dirc |= 8; } + if( *pim & m2 ) { dirc |= 8u; } pim += strideX; - if( *pim & m2 ) { dirc |= 4; } + if( *pim & m2 ) { dirc |= 4u; } pim += strideX; - if( *pim & m2 ) { dirc |= 2; } + if( *pim & m2 ) { dirc |= 2u; } pim += strideY2; - if( *pim & m2 ) { dirc |= 128; } + if( *pim & m2 ) { dirc |= 128u; } pim -= strideX; - if( *pim & m2 ) { dirc |= 64; } + if( *pim & m2 ) { dirc |= 64u; } pim -= strideX; - if( *pim & m2 ) { dirc |= 32; } + if( *pim & m2 ) { dirc |= 32u; } if( luthile[ dirc ] ) { continue; } // totally recursive neighbourhood will be build in register byte @@ -802,34 +802,34 @@ void Eusk2D( // and mi == 0, a situation which does not occur normally pim += strideX; if(( *pim & m1 ) == m2 ) { - if( luthil[ 0 ][ dirc & ~64 ] ) { continue; } - breg &= ~64; + if( luthil[ 0 ][ dirc & ~64u ] ) { continue; } + breg &= ~64u; } pim -= strideY - strideX; if(( *pim & m1 ) == m2 ) { - if( luthil[ 0 ][ dirc & ~1 ] ) { continue; } - breg &= ~1; + if( luthil[ 0 ][ dirc & ~1u ] ) { continue; } + breg &= ~1u; } pim -= strideX2; if(( *pim & m1 ) == m2 ) { - if( luthil[ 0 ][ dirc & ~16 ] ) { continue; } - breg &= ~16; + if( luthil[ 0 ][ dirc & ~16u ] ) { continue; } + breg &= ~16u; } pim -= strideY - strideX; if(( *pim & m1 ) == m2 ) { - if( luthil[ 0 ][ dirc & ~4 ] ) { continue; } - breg &= ~4; + if( luthil[ 0 ][ dirc & ~4u ] ) { continue; } + breg &= ~4u; } // test totally recursive neighbourhood pim += strideX; - if(( *pim & m1 ) == m2 ) { breg &= ~2; } + if(( *pim & m1 ) == m2 ) { breg &= ~2u; } pim -= strideX2; - if(( *pim & m1 ) == m2 ) { breg &= ~8; } + if(( *pim & m1 ) == m2 ) { breg &= ~8u; } pim += strideY2; - if(( *pim & m1 ) == m2 ) { breg &= ~32; } + if(( *pim & m1 ) == m2 ) { breg &= ~32u; } pim += strideX2; - if(( *pim & m1 ) == m2 ) { breg &= ~128; } + if(( *pim & m1 ) == m2 ) { breg &= ~128u; } if( luthil[ 0 ][ breg ] ) { continue; } // change pixel, by temporarily removing input mask @@ -4691,9 +4691,9 @@ void EuclideanSkeleton( if( out.Dimensionality() == 2 ) { Eusk2D( static_cast< uint8* >( out.Origin() ), - uint8( 1 << 0 ), - uint8( 1 << 1 ), - uint8( 1 << 2 ), + uint8( 1u << 0u ), + uint8( 1u << 1u ), + uint8( 1u << 2u ), endPixelCondition, edgeCondition, 5, 7, 11, 0, static_cast< dip::sint >( out.Size( 0 )), @@ -4703,9 +4703,9 @@ void EuclideanSkeleton( } else { Eusk3D( static_cast< uint8* >( out.Origin() ), - uint8( 1 << 0 ), - uint8( 1 << 1 ), - uint8( 1 << 2 ), + uint8( 1u << 0u ), + uint8( 1u << 1u ), + uint8( 1u << 2u ), endPixelCondition, edgeCondition, 4, 6, 7, 9, 10, 12, 0, static_cast< dip::sint >( out.Size( 0 )), diff --git a/src/morphology/pathopening.cpp b/src/morphology/pathopening.cpp index 32471205..16fa90a7 100644 --- a/src/morphology/pathopening.cpp +++ b/src/morphology/pathopening.cpp @@ -111,9 +111,9 @@ void MakeNeighborLists( using PathLenType = uint16; constexpr auto DT_PATHLEN = DT_UINT16; -constexpr uint8 PO_ACTIVE = 1; -constexpr uint8 PO_QUEUED = 2; -constexpr uint8 PO_CHANGED = 4; +constexpr unsigned PO_ACTIVE = 1; +constexpr unsigned PO_QUEUED = 2; +constexpr unsigned PO_CHANGED = 4; using PixelQueue = std::queue< dip::sint >;