Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libarch/alpha Add a cast of the shift count to int32_t, ...



details:   https://anonhg.NetBSD.org/src/rev/d7aa4374f013
branches:  trunk
changeset: 778323:d7aa4374f013
user:      he <he%NetBSD.org@localhost>
date:      Thu Mar 22 08:54:48 2012 +0000

description:
Add a cast of the shift count to int32_t, so that we don't try
to do int32_t << long, since ANSI C doesn't perform "balancing"
before the shift operation according to lint.  Should not make a
difference, offset is limited to 0..3 anyway.

diffstat:

 lib/libarch/alpha/alpha_pci_io.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 945d4ad622aa -r d7aa4374f013 lib/libarch/alpha/alpha_pci_io.c
--- a/lib/libarch/alpha/alpha_pci_io.c  Thu Mar 22 08:52:22 2012 +0000
+++ b/lib/libarch/alpha/alpha_pci_io.c  Thu Mar 22 08:54:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: alpha_pci_io.c,v 1.5 2008/04/28 20:22:55 martin Exp $  */
+/*     $NetBSD: alpha_pci_io.c,v 1.6 2012/03/22 08:54:48 he Exp $      */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -195,7 +195,7 @@
 {
        uint32_t *port = alpha_pci_io_swiz(ioaddr, 0);
        bus_addr_t offset = ioaddr & 3;
-       uint32_t nval = ((uint32_t)val) << (8 * offset);
+       uint32_t nval = ((uint32_t)val) << (uint32_t)(8 * offset);
 
        *port = nval;
        alpha_mb();
@@ -206,7 +206,7 @@
 {
        uint32_t *port = alpha_pci_io_swiz(ioaddr, 1);
        bus_addr_t offset = ioaddr & 3;
-       uint32_t nval = ((uint32_t)val) << (8 * offset);
+       uint32_t nval = ((uint32_t)val) << (uint32_t)(8 * offset);
 
        *port = nval;
        alpha_mb();



Home | Main Index | Thread Index | Old Index