"if c:" can never be false, since we checked before.
Remove the extra condition.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
result = 0
offset = 0
# Handle first byte with sign bit specially.
- if c:
- b = ord(c)
- if b & 0x40:
- negative = True
- result |= (b & 0x3f)
- if b & 0x80:
- offset += 6
- c = port.read(1)
- elif negative:
- return -result
- else:
- return result
+ b = ord(c)
+ if b & 0x40:
+ negative = True
+ result |= (b & 0x3f)
+ if b & 0x80:
+ offset += 6
+ c = port.read(1)
+ elif negative:
+ return -result
+ else:
+ return result
while True:
b = ord(c)
if b & 0x80: