diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-06-05 18:52:48 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-06-05 18:52:48 +0000 |
commit | e46f8ac9ef86ab5709bb4cccb665cedaa1ca708b (patch) | |
tree | 719843fa2eed14133ac97f21657ff6cba67a06f0 /sys/dev/pci | |
parent | 8246ce26cd8453f17900e5779d801ab364994f07 (diff) |
change sign extension such that we do not rely on >> being an
arithmetic shift on signed integers.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_iwn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index f2fc69c9448..744700e7691 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.96 2010/05/13 09:25:03 damien Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.97 2010/06/05 18:52:47 damien Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -3674,7 +3674,7 @@ iwn4965_get_temperature(struct iwn_softc *sc) return 0; /* Sign-extend 23-bit R4 value to 32-bit. */ - r4 = (r4 << 8) >> 8; + r4 = ((r4 & 0xffffff) ^ 0x800000) - 0x800000; /* Compute temperature in Kelvin. */ temp = (259 * (r4 - r2)) / (r3 - r1); temp = (temp * 97) / 100 + 8; |