Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/include/arm32 Explicitely cast to unsigned. Avo...



details:   https://anonhg.NetBSD.org/src/rev/a3e8f7261a0c
branches:  trunk
changeset: 787030:a3e8f7261a0c
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Wed May 29 23:29:44 2013 +0000

description:
Explicitely cast to unsigned. Avoid bugs caused by misintepreting the result as
signed.

riastradh@ suggested to change these macros into static inline functions.
But I'm still not convinced...

Obtained from Marvell, Semihalf.

diffstat:

 sys/arch/arm/include/arm32/param.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r 403d92124027 -r a3e8f7261a0c sys/arch/arm/include/arm32/param.h
--- a/sys/arch/arm/include/arm32/param.h        Wed May 29 23:25:55 2013 +0000
+++ b/sys/arch/arm/include/arm32/param.h        Wed May 29 23:29:44 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.h,v 1.19 2013/03/20 13:43:39 skrll Exp $ */
+/*     $NetBSD: param.h,v 1.20 2013/05/29 23:29:44 rkujawa Exp $       */
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -89,8 +89,8 @@
 #define USPACE_SVC_STACK_TOP           (USPACE)
 #define USPACE_SVC_STACK_BOTTOM                (sizeof(struct pcb))
 
-#define arm_btop(x)                    ((x) >> PGSHIFT)
-#define arm_ptob(x)                    ((x) << PGSHIFT)
+#define arm_btop(x)                    ((unsigned)(x) >> PGSHIFT)
+#define arm_ptob(x)                    ((unsigned)(x) << PGSHIFT)
 #define arm_trunc_page(x)              ((unsigned)(x) & ~PGOFSET)
     
 #ifdef _KERNEL



Home | Main Index | Thread Index | Old Index