diff options
author | Daniel Mack <daniel@zonque.org> | 2014-09-17 18:39:22 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-10-12 14:15:12 +0000 |
commit | ed0b19b94bf07056b5e0cfe64d4d05c3ebae801a (patch) | |
tree | 4c4dd80aa856bf0a4c55704c88761a2d2ab2199a /epan/to_str.c | |
parent | 29afac24a579b01c029b2b5404bda7a102fe2232 (diff) |
Make boolean bitmask type 64-bit wide
There are protocols out there that have 64-bit wide bit mask fields, so
make the internal representation and bitfield decoders 64-bit aware.
For this, the ws_ctz() fallback and bits_count_ones() have to be tweaked
slightly.
Change-Id: I19237b954a69c9e6c55864f281993c1e8731a233
Reviewed-on: https://code.wireshark.org/review/4158
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/to_str.c')
-rw-r--r-- | epan/to_str.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/to_str.c b/epan/to_str.c index 5b42179001..f9b876a0e0 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -996,15 +996,15 @@ decode_bits_in_field(const guint bit_offset, const gint no_of_bits, const guint6 Return a pointer to the character after that string. */ /*XXX this needs a buf_len check */ char * -other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, const int width) +other_decode_bitfield_value(char *buf, const guint64 val, const guint64 mask, const int width) { int i; - guint32 bit; + guint64 bit; char *p; i = 0; p = buf; - bit = 1 << (width - 1); + bit = 1ULL << (width - 1); for (;;) { if (mask & bit) { /* This bit is part of the field. Show its value. */ @@ -1028,7 +1028,7 @@ other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, co } char * -decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, const int width) +decode_bitfield_value(char *buf, const guint64 val, const guint64 mask, const int width) { char *p; @@ -1041,7 +1041,7 @@ decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, const in /* Generate a string describing a numeric bitfield (an N-bit field whose value is just a number). */ const char * -decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width, +decode_numeric_bitfield(const guint64 val, const guint64 mask, const int width, const char *fmt) { char *buf; @@ -1051,7 +1051,7 @@ decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width, buf=(char *)ep_alloc(1025); /* isn't this a bit overkill? */ /* Compute the number of bits we have to shift the bitfield right to extract its value. */ - while ((mask & (1<<shift)) == 0) + while ((mask & (1ULL << shift)) == 0) shift++; p = decode_bitfield_value(buf, val, mask, width); |