* [9front] [patch] games/blit: Make 32-bit unsigned complement zero-extended to 64 bits explicit to silence compiler warning
@ 2024-11-23 15:32 Alexander Kapshuk
0 siblings, 0 replies; only message in thread
From: Alexander Kapshuk @ 2024-11-23 15:32 UTC (permalink / raw)
To: 9front
Compilation outputs these warnings:
cpu% mk
6c -FTVw blit.c
6c -FTVw cpu.c
6c -FTVw mem.c
6c -FTVw telnet.c
warning: cpu.c:244 32-bit unsigned complement zero-extended to 64 bits
warning: cpu.c:255 32-bit unsigned complement zero-extended to 64 bits
warning: cpu.c:266 32-bit unsigned complement zero-extended to 64 bits
6l -o 6.out blit.6 cpu.6 mem.6 telnet.6
Type cast one of the u32int variables involved in the expression to
u64int to make zero-extension explicit and silence compiler warning.
diff 0676a1ba51784e2b44ce9100965e4554e13e48b9 uncommitted
--- a/sys/src/games/blit/cpu.c
+++ b/sys/src/games/blit/cpu.c
@@ -241,7 +241,7 @@
rS |= FLAGC;
if((v & 0x80) != 0)
rS |= FLAGN;
- if((~(w ^ u) & (v ^ u) & 0x80) != 0)
+ if((~((u64int)w ^ u) & (v ^ u) & 0x80) != 0)
rS |= FLAGV;
if((u8int)v != 0)
rS &= ~FLAGZ;
@@ -252,7 +252,7 @@
rS |= FLAGC;
if((v & 0x8000) != 0)
rS |= FLAGN;
- if((~(w ^ u) & (v ^ u) & 0x8000) != 0)
+ if((~((u64int)w ^ u) & (v ^ u) & 0x8000) != 0)
rS |= FLAGV;
if((u16int)v != 0)
rS &= ~FLAGZ;
@@ -263,7 +263,7 @@
rS |= FLAGC;
if((v & 0x80000000) != 0)
rS |= FLAGN;
- if((~(w ^ u) & (v ^ u) & 0x80000000) != 0)
+ if((~((u64int)w ^ u) & (v ^ u) & 0x80000000) != 0)
rS |= FLAGV;
if((u32int)v != 0)
rS &= ~FLAGZ;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-23 15:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-23 15:32 [9front] [patch] games/blit: Make 32-bit unsigned complement zero-extended to 64 bits explicit to silence compiler warning Alexander Kapshuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).