Skip to content

Commit 5115abe

Browse files
Skip useless compare to LONG_MAX in to_python(unsigned u)
As LONG_MAX is larger than any value representable by unsigned (int) on most platforms, the test in the method do not make sense on these. And 'unsigned long' can represent any value of unsigned int, so drop the test. Get rid of warning discovered with clang.
1 parent c8dd11e commit 5115abe

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/hal/halmodule.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ PyObject *to_python(bool b) {
3939
return PyBool_FromLong(b);
4040
}
4141

42-
PyObject *to_python(unsigned u) {
43-
if(u < LONG_MAX) return PyLong_FromLong(u);
42+
PyObject *to_python(unsigned int u) {
4443
return PyLong_FromUnsignedLong(u);
4544
}
4645

0 commit comments

Comments
 (0)