summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2009-01-16 07:28:01 +0100
committerNeal H. Walfield <neal@gnu.org>2009-01-16 07:28:01 +0100
commit8bebe06303f91c90b3fb5879da3f3b0a825c55d1 (patch)
tree5bdecc6a9790f0952e0d6e84c4a4476587db01fc
parenta42cdb23a65d581ba7a7fdd3144ffa3ddc287f64 (diff)
Change the type of extract_bits data argument to uintptr_t.
2009-01-16 Neal H. Walfield <neal@gnu.org> * bits.h (extract_bits): Make W a uintptr_t, not an unsigned int. (extract_bits_inv): Likewise.
-rw-r--r--libhurd-mm/ChangeLog5
-rw-r--r--libhurd-mm/bits.h16
2 files changed, 13 insertions, 8 deletions
diff --git a/libhurd-mm/ChangeLog b/libhurd-mm/ChangeLog
index 3a9a35b..3207a4e 100644
--- a/libhurd-mm/ChangeLog
+++ b/libhurd-mm/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-16 Neal H. Walfield <neal@gnu.org>
+
+ * bits.h (extract_bits): Make W a uintptr_t, not an unsigned int.
+ (extract_bits_inv): Likewise.
+
2008-12-18 Neal H. Walfield <neal@gnu.org>
* anonymous.c (fault): Batch object discard requests.
diff --git a/libhurd-mm/bits.h b/libhurd-mm/bits.h
index 22823e3..d1b8476 100644
--- a/libhurd-mm/bits.h
+++ b/libhurd-mm/bits.h
@@ -1,5 +1,5 @@
/* bits.h - Bit manipulation functions.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
Written by Neal H. Walfield <neal@gnu.org>.
This file is part of the GNU Hurd.
@@ -25,15 +25,15 @@
#include <assert.h>
/* Return the C bits of word W starting a bit S. (The LSB is 0 and
- the MSB is L4_WORDSIZE.) */
+ the MSB is WORDSIZE.) */
static inline unsigned int
-extract_bits (unsigned int w, int s, int c)
+extract_bits (uintptr_t w, int s, int c)
{
- assert (0 <= s && s < (sizeof (unsigned int) * 8));
- assert (0 <= c && s + c <= (sizeof (unsigned int) * 8));
+ assert (0 <= s && s < (sizeof (uintptr_t) * 8));
+ assert (0 <= c && s + c <= (sizeof (uintptr_t) * 8));
if (c == (sizeof (unsigned int) * 8))
- /* 1U << (sizeof (unsigned int) * 8) is problematic: "If the value of
+ /* 1U << (sizeof (uintptr_t) * 8) is problematic: "If the value of
the right operand is negative or is greater than or equal to
the width of the promoted left operand, the behavior is
undefined." */
@@ -62,8 +62,8 @@ extract_bits64 (uint64_t w, int s, int c)
/* Return the C bits of word W ending at bit E. (The LSB is 0 and the
MSB is (sizeof (unsigned int) * 8).) */
-static inline unsigned int
-extract_bits_inv (unsigned int w, int e, int c)
+static inline uintptr_t
+extract_bits_inv (uintptr_t w, int e, int c)
{
/* We special case this check here to allow extract_bits_inv (w, 31,
0). */