2 parents 153bbd0 + 9ea779c commit e46c1a5Copy full SHA for e46c1a5
1 file changed
algorithms/bit_manipulation/add_bitwise_operator.py
@@ -30,6 +30,8 @@ def add_bitwise_operator(first: int, second: int) -> int:
30
>>> add_bitwise_operator(0, 0)
31
0
32
"""
33
+ if first < 0 or second < 0:
34
+ raise ValueError("The provided values must be non-negative!")
35
while second:
36
carry = first & second
37
first = first ^ second
0 commit comments