Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Cast the sizeof operator to unsigned int in the __NF...
details: https://anonhg.NetBSD.org/src/rev/769556bbec0a
branches: trunk
changeset: 572420:769556bbec0a
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 02 18:33:14 2005 +0000
description:
Cast the sizeof operator to unsigned int in the __NFDBITS macro because it
is used as the RHS of a << operator. On machines where size_t is unsigned
long, and _LP64, we effectively get int32 << uint64 which is handled
differently in ansi c than K&R. In K&R the int32 would get promoted.
diffstat:
sys/sys/types.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (20 lines):
diff -r 85877c5e84ec -r 769556bbec0a sys/sys/types.h
--- a/sys/sys/types.h Sun Jan 02 18:32:38 2005 +0000
+++ b/sys/sys/types.h Sun Jan 02 18:33:14 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.63 2004/04/21 01:05:43 christos Exp $ */
+/* $NetBSD: types.h,v 1.64 2005/01/02 18:33:14 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -298,7 +298,9 @@
*/
#define __NBBY 8 /* number of bits in a byte */
typedef int32_t __fd_mask;
-#define __NFDBITS (sizeof(__fd_mask) * __NBBY) /* bits per mask */
+
+/* bits per mask */
+#define __NFDBITS ((unsigned int)sizeof(__fd_mask) * __NBBY)
#ifndef howmany
#define __howmany(x, y) (((x) + ((y) - 1)) / (y))
Home |
Main Index |
Thread Index |
Old Index