Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Address implicit long conversion warning #569

Merged

Conversation

thewtex
Copy link
Contributor

@thewtex thewtex commented Dec 16, 2018

To address:

/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:257:67: warning: implicit conversion from 'unsigned long long' to 'const long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
static constexpr long maxval = sizeof(long)==8?(vxl_uint_64)(-1)/2:0x7fffffffL; // = 0x7fffffffL or 0x7fffffffffffffffL;
~~~~~~ ~~~~~~~~~~~~~~~~~^~
/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:278:70: warning: implicit conversion from 'vxl_uint_64' (aka 'unsigned long long') to 'const unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
static constexpr unsigned long maxval = sizeof(unsigned long)==8?((vxl_uint_64)(-1)):0xffffffffL ;
~~~~~~ ^~~~~~~~~~~~~~~~~

To address:

/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:257:67: warning: implicit conversion from 'unsigned long long' to 'const long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
  static constexpr long maxval = sizeof(long)==8?(vxl_uint_64)(-1)/2:0x7fffffffL; // = 0x7fffffffL or 0x7fffffffffffffffL;
                        ~~~~~~                   ~~~~~~~~~~~~~~~~~^~
/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:278:70: warning: implicit conversion from 'vxl_uint_64' (aka 'unsigned long long') to 'const unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
  static constexpr unsigned long maxval =  sizeof(unsigned long)==8?((vxl_uint_64)(-1)):0xffffffffL ;
                                 ~~~~~~                              ^~~~~~~~~~~~~~~~~
@thewtex
Copy link
Contributor Author

thewtex commented Dec 16, 2018

@hjmjohnson please take a look

Copy link
Contributor

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matt. Nice catch to remove a compiler warning.

@hjmjohnson hjmjohnson merged commit bb0d2eb into vxl:master Dec 16, 2018
@thewtex thewtex deleted the long-implicit-conversion branch December 16, 2018 03:41
@thewtex
Copy link
Contributor Author

thewtex commented Dec 16, 2018

Thanks for the quick review / merge @hjmjohnson !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants