Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys To quote C99 6.3.1.1:
details: https://anonhg.NetBSD.org/src/rev/3b7cdb739c4b
branches: trunk
changeset: 569902:3b7cdb739c4b
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Sep 13 01:24:46 2004 +0000
description:
To quote C99 6.3.1.1:
If an int can represent all values of the original type, the value is
converted to an int; otherwise, it is converted to an unsigned int. These
are called the integer promotions. 48) All other types are unchanged by
the integer promotions.
So, cast an "unsigned short" to an "unsigned int" before right-shifting it
in order to avoid a lint warning.
diffstat:
sys/sys/endian.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 96a9a31d19a0 -r 3b7cdb739c4b sys/sys/endian.h
--- a/sys/sys/endian.h Sun Sep 12 23:17:37 2004 +0000
+++ b/sys/sys/endian.h Mon Sep 13 01:24:46 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: endian.h,v 1.10 2004/09/12 23:17:37 thorpej Exp $ */
+/* $NetBSD: endian.h,v 1.11 2004/09/13 01:24:46 thorpej Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -181,7 +181,7 @@
{
uint8_t *p = buf;
- p[0] = (u >> 8) & 0xff;
+ p[0] = ((unsigned)u >> 8) & 0xff;
p[1] = u & 0xff;
}
@@ -191,7 +191,7 @@
uint8_t *p = buf;
p[0] = u & 0xff;
- p[1] = (u >> 8) & 0xff;
+ p[1] = ((unsigned)u >> 8) & 0xff;
}
static __inline uint16_t __unused
Home |
Main Index |
Thread Index |
Old Index