Skip to content

Commit 8efa7cc

Browse files
committed
Avoid checking if an unsigned number is below 0
`object_bits <= 0` suggests that `object_bits` could be below zero. This is not possible because `object_bits` is unsigned. Checking for equal to zero makes it explicit that we are checking for one specific value.
1 parent ba0fdb6 commit 8efa7cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ configt::bv_encodingt parse_object_bits_encoding(
786786
const auto object_bits = string2optional<unsigned int>(argument);
787787
if(!object_bits)
788788
throw_for_reason("not a valid unsigned integer");
789-
if(*object_bits <= 0 || *object_bits >= pointer_width)
789+
if(*object_bits == 0 || *object_bits >= pointer_width)
790790
throw_for_reason("out of range");
791791

792792
configt::bv_encodingt bv_encoding;

0 commit comments

Comments
 (0)