Skip to content

Commit e46c1a5

Browse files
authored
Merge pull request #2769 from KeyboardZ7/KeyboardZ7-patch-1
Update add_bitwise_operator.py
2 parents 153bbd0 + 9ea779c commit e46c1a5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

algorithms/bit_manipulation/add_bitwise_operator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def add_bitwise_operator(first: int, second: int) -> int:
3030
>>> add_bitwise_operator(0, 0)
3131
0
3232
"""
33+
if first < 0 or second < 0:
34+
raise ValueError("The provided values must be non-negative!")
3335
while second:
3436
carry = first & second
3537
first = first ^ second

0 commit comments

Comments
 (0)