From d8b3680268a4390891e74f0b7b58d8cddabcd0b0 Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 5 Jun 2023 22:16:01 +0200 Subject: Fix stupid overflow --- src/img/bitmap.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/img') diff --git a/src/img/bitmap.nim b/src/img/bitmap.nim index f944ad59..7c694370 100644 --- a/src/img/bitmap.nim +++ b/src/img/bitmap.nim @@ -175,7 +175,7 @@ type PNGWriter = object outlen: int func pngInt(i: uint32): auto = - doAssert i < uint32(2 ^ 31) + doAssert i < uint32(2) ^ 31 return i.toBytesBE() func oq(writer: PNGWriter): ptr UncheckedArray[uint8] = @@ -192,7 +192,7 @@ proc writeInt(writer: var PNGWriter, i: uint32) = writer.writeStr(i.toBytesBE()) proc writePngInt(writer: var PNGWriter, i: uint32) = - doAssert i < uint32(2 ^ 31) + doAssert i < uint32(2) ^ 31 writer.writeInt(i) proc writeChunk[T](writer: var PNGWriter, t: string, data: T) = @@ -334,7 +334,7 @@ template readU32(reader: var PNGReader): uint32 = template readPNGInt(reader: var PNGReader): uint32 = let x = reader.readU32() - if x >= uint32(2 ^ 31): + if x >= uint32(2) ^ 31: reader.err "int too large" x -- cgit 1.4.1-2-gfad0