document that low bitsize integers don't have complete arithmetic support (#320)

* document that low bitsize integers don't have complete arithmetic support
This commit is contained in:
Ty Overby
2018-05-07 09:10:01 -07:00
committed by Dan Gohman
parent 5b69930e03
commit 09f883182d

View File

@@ -200,10 +200,15 @@ class IntType(LaneType):
def __init__(self, bits): def __init__(self, bits):
# type: (int) -> None # type: (int) -> None
assert bits > 0, 'IntType must have positive number of bits' assert bits > 0, 'IntType must have positive number of bits'
warning = ""
if bits < 32:
warning += "\nWARNING: "
warning += "arithmetic on {}bit integers is incomplete".format(
bits)
super(IntType, self).__init__( super(IntType, self).__init__(
name='i{:d}'.format(bits), name='i{:d}'.format(bits),
membytes=bits // 8, membytes=bits // 8,
doc="An integer type with {} bits.".format(bits)) doc="An integer type with {} bits.{}".format(bits, warning))
self.bits = bits self.bits = bits
def __repr__(self): def __repr__(self):