Wireshark-bugs: [Wireshark-bugs] [Bug 9055] Support for bitmask set for types FT_INT8, FT_INT16,
Date: Tue, 20 Aug 2013 22:26:39 +0000

Comment # 2 on bug 9055 from
The code was stolen from _proto_tree_add_bits_ret_val function. Yes, there
should be G_GINT32_CONSTANT but this is not defined. I think that oversize
doesn't matter, it is cut and may be optimized by the compiler.

Arithmetic shift will not do the right thing.

This code checks if the sign bit is set in shifted value.

----

for value 7 (sign bit not set, condition is not met)
bitmask       0011 1100  no_of_bits=4
                sb bb    "s" is a sign bit
value         0001 1100
shifted value 0000 0111 = 7
result        0000 0111 = 7

-----

for value -8 (sign bit set, condition is met, )
bitmask       0011 1100  no_of_bits=4
                sb bb     "s" is a sign bit
value         0010 0000
shifted value 0000 1000 = 8
result        1111 1000 = -8


You are receiving this mail because:
  • You are watching all bug changes.