mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[python] Make python lint pass (#4296)
This commit is contained in:
committed by
GitHub
parent
46858eb2ee
commit
751e8c51ac
@@ -14,14 +14,17 @@ _all_integer_type_bitwidths = [8, 16, 32, 64]
|
||||
# Number of bits in the biggest int type
|
||||
int_max_bits = max(_all_integer_type_bitwidths)
|
||||
|
||||
def int_max(bits, signed):
|
||||
bits = bits - 1 if signed else bits
|
||||
|
||||
def int_max(bits, signed):
|
||||
bits = bits - 1 if signed else bits
|
||||
bits = max(bits, 0)
|
||||
return (1 << bits) - 1
|
||||
|
||||
|
||||
|
||||
def int_min(bits, signed):
|
||||
return (-1 * int_max(bits, signed) - 1) if signed else 0
|
||||
|
||||
|
||||
class SwiftIntegerType(object):
|
||||
|
||||
def __init__(self, is_word, bits, is_signed):
|
||||
@@ -33,7 +36,7 @@ class SwiftIntegerType(object):
|
||||
self.possible_bitwidths = [32, 64]
|
||||
else:
|
||||
self.possible_bitwidths = [bits]
|
||||
|
||||
|
||||
self.min = int_min(bits, is_signed)
|
||||
self.max = int_max(bits, is_signed)
|
||||
|
||||
@@ -128,4 +131,3 @@ def all_integer_assignment_operator_names():
|
||||
|
||||
def all_integer_or_real_assignment_operator_names():
|
||||
return ['=', '*=', '/=', '+=', '-=']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user