summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-03-15 03:55:29 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-03-15 03:55:29 +0000
commit28bbf328a9eeec96bdbefd418fc5cda9ae715189 (patch)
tree44a3852702a96981f77847191a948012de9a988b /bits.c
parentc3440b1f32c506629998b3a0e47928f91d037640 (diff)
downloadgpsd-28bbf328a9eeec96bdbefd418fc5cda9ae715189.tar.gz
Remove a word-width dependency.
Diffstat (limited to 'bits.c')
-rw-r--r--bits.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bits.c b/bits.c
index 0757d3e6..41599634 100644
--- a/bits.c
+++ b/bits.c
@@ -3,7 +3,7 @@
* Bitfield extraction functions. In each, start is a bit index (not
* a byte index) and width is a bit width. The width bounded above by
* the bit width of a long long, which s 64 bits in all standard data
- * models for 64-bit processors.
+ * models for 32- and 64-bit processors.
*
* The sbits() function assumes twos-complement arithmetic.
*/
@@ -44,7 +44,7 @@ unsigned long long ubits(char buf[], unsigned int start, unsigned int width)
#endif /* UDEBUG */
}
- fld &= ~(0xffffffff << width);
+ fld &= ~(-1LL << width);
#ifdef UDEBUG
printf("After selecting out the bottom %u bits: 0x%llx = %lld\n",
width, fld, fld);