summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--epan/proto.c10
-rw-r--r--epan/to_str.c4
-rw-r--r--ui/gtk/packet_panes.c4
-rw-r--r--wsutil/bits_count_ones.h8
4 files changed, 13 insertions, 13 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 3d7c2e5860..8319b4abe0 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -3507,7 +3507,7 @@ proto_tree_set_uint(field_info *fi, guint32 value)
if (hfinfo->bitmask) {
/* Mask out irrelevant portions */
- integer &= hfinfo->bitmask;
+ integer &= (guint32)(hfinfo->bitmask);
/* Shift bits */
integer >>= hfinfo_bitshift(hfinfo);
@@ -3649,7 +3649,7 @@ proto_tree_set_int(field_info *fi, gint32 value)
if (hfinfo->bitmask) {
/* Mask out irrelevant portions */
- integer &= hfinfo->bitmask;
+ integer &= (guint32)(hfinfo->bitmask);
/* Shift bits */
integer >>= hfinfo_bitshift(hfinfo);
@@ -7028,10 +7028,10 @@ proto_registrar_dump_fields(void)
else if (strlen(blurb) == 0)
blurb = "\"\"";
- printf("F\t%s\t%s\t%s\t%s\t%s\t0x%llx\t%s\n",
+ printf("F\t%s\t%s\t%s\t%s\t%s\t0x%" G_GINT64_MODIFIER "x\t%s\n",
hfinfo->name, hfinfo->abbrev, enum_name,
parent_hfinfo->abbrev, base_name,
- (unsigned long long) hfinfo->bitmask, blurb);
+ hfinfo->bitmask, blurb);
}
}
}
@@ -7396,7 +7396,7 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
case 8:
value = encoding ? tvb_get_letoh64(tvb, offset) :
tvb_get_ntoh64(tvb, offset);
- available_bits = 0xFFFFFFFFFFFFFFFF;
+ available_bits = G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF);
break;
default:
g_assert_not_reached();
diff --git a/epan/to_str.c b/epan/to_str.c
index f9b876a0e0..c12e58b3f3 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -1004,7 +1004,7 @@ other_decode_bitfield_value(char *buf, const guint64 val, const guint64 mask, co
i = 0;
p = buf;
- bit = 1ULL << (width - 1);
+ bit = G_GUINT64_CONSTANT(1) << (width - 1);
for (;;) {
if (mask & bit) {
/* This bit is part of the field. Show its value. */
@@ -1051,7 +1051,7 @@ decode_numeric_bitfield(const guint64 val, const guint64 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 & (1ULL << shift)) == 0)
+ while ((mask & (G_GUINT64_CONSTANT(1) << shift)) == 0)
shift++;
p = decode_bitfield_value(buf, val, mask, width);
diff --git a/ui/gtk/packet_panes.c b/ui/gtk/packet_panes.c
index 36888ab61a..e8c193711c 100644
--- a/ui/gtk/packet_panes.c
+++ b/ui/gtk/packet_panes.c
@@ -961,7 +961,7 @@ packet_hex_print(GtkWidget *bv, const guint8 *pd, frame_data *fd,
/* XXX, mask has only 32 bit, later we can store bito&bitc, and use them (which should be faster) */
if (bitt > 0 && bitt < 32) {
- bmask = ((1ULL << bitc) - 1) << ((8-bitt) & 7);
+ bmask = ((G_GUINT64_CONSTANT(1) << bitc) - 1) << ((8-bitt) & 7);
bmask_le = 0; /* ? */
}
}
@@ -1025,7 +1025,7 @@ packet_hex_editor_print(GtkWidget *bv, const guint8 *pd, frame_data *fd, int off
break;
case BYTES_BITS:
- bmask = (1ULL << (7-bitoffset));
+ bmask = (G_GUINT64_CONSTANT(1) << (7-bitoffset));
break;
default:
diff --git a/wsutil/bits_count_ones.h b/wsutil/bits_count_ones.h
index 6a8fa1a555..f9a8c7c12b 100644
--- a/wsutil/bits_count_ones.h
+++ b/wsutil/bits_count_ones.h
@@ -41,11 +41,11 @@ ws_count_ones(const guint64 x)
{
unsigned long long bits = x;
- bits = bits - ((bits >> 1) & 0x5555555555555555ULL);
- bits = (bits & 0x3333333333333333ULL) + ((bits >> 2) & 0x3333333333333333ULL);
- bits = (bits + (bits >> 4)) & 0x0F0F0F0F0F0F0F0F;
+ bits = bits - ((bits >> 1) & G_GUINT64_CONSTANT(0x5555555555555555));
+ bits = (bits & G_GUINT64_CONSTANT(0x3333333333333333)) + ((bits >> 2) & G_GUINT64_CONSTANT(0x3333333333333333));
+ bits = (bits + (bits >> 4)) & G_GUINT64_CONSTANT(0x0F0F0F0F0F0F0F0F);
- return (bits * 0x0101010101010101ULL) >> 56;
+ return (int)((bits * G_GUINT64_CONSTANT(0x0101010101010101)) >> 56);
}
#endif /* __WSUTIL_BITS_COUNT_ONES_H__ */