ull literal support and test (#5789)

* ull literal support and test

* missing .numpy()
This commit is contained in:
samm393
2024-07-29 16:50:49 +01:00
committed by GitHub
parent 71e1472290
commit 2c94316bd2
2 changed files with 5 additions and 1 deletions

View File

@@ -267,7 +267,10 @@ class TestInt32DType(TestDType): DTYPE = dtypes.int32
class TestUint32DType(TestDType): DTYPE = dtypes.uint32
class TestInt64DType(TestDType): DTYPE = dtypes.int64
class TestUint64DType(TestDType): DTYPE = dtypes.uint64
class TestUint64DType(TestDType):
DTYPE = dtypes.uint64
def test_uint64_load(self):
assert Tensor(2**64 - 1, dtype=dtypes.uint64).numpy() == 2**64 - 1
class TestBoolDType(TestDType): DTYPE = dtypes.bool

View File

@@ -50,6 +50,7 @@ class CStyleLanguage(Renderer):
elif math.isinf(x): val = ("-" if x < 0 else "") + "INFINITY"
elif dtype.scalar() == dtypes.bool: val = "1" if x else "0"
elif dtype.scalar() == dtypes.float: val = f"{x}f"
elif dtype.scalar() == dtypes.uint64: val = f"{x}ULL"
else: val = str(x)
if dtype.count > 1: return self.render_vectorize([val] * dtype.count, dtype)
return (self.render_cast(val, dtype) if dtype not in [dtypes.float, dtypes.int, dtypes.bool] else val)