Wireshark mailing list archives
Re: Why tvb_get_bits() assumes Big Endian?
From: Roland Knall <rknall () gmail com>
Date: Thu, 30 Jul 2020 09:17:18 +0200
Putting the complexity in the common code will increase the complexity for a lot of other stuff which relies on this functionality. Also you run the risk of increasing dissection time for more protocols, then if you handle it specifically. That would be my reasoning against it cheers Am Do., 30. Juli 2020 um 08:59 Uhr schrieb Tomasz Moń <desowin () gmail com>:
On Thu, Jul 30, 2020 at 8:30 AM Jaap Keuter <jaap.keuter () xs4all nl> wrote:Let’s put a hypothetical here, a 7 bit value spanning 2 octets: 15 14 13 12 11 10 9 8| 7 6 5 4 3 2 1 0 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | | | | | | 6| 5| 4| 3| 2| 1| 0| | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ This would be the typical interpretation, as seen in network protocols. Your suggestion is that the interpretation can also be: 15 14 13 12 11 10 9 8| 7 6 5 4 3 2 1 0 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | | | | | | 1| 0| 6| 5| 4| 3| 2| | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+This is not what I wanted to write. Assuming you meant two octets, and the bitmask on the 16-bit value is 0x1FC0 then the alternative interpretation would be: 15 14 13 12 11 10 9 8| 7 6 5 4 3 2 1 0 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | | | | | | 4| 3| 2| 1| 0| 6| 5| | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+Here the first interpretation is a simple matter of mask and shift, thesecond interpretation is somewhat more involved. Since the first interpretation is common in network protocols (and efficient to handle) the code was made with that in mind. Is the complexity the only reason? I prefer the complex things to be in the common code and not in individual dissectors. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org ?subject=unsubscribe
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 29)
- Re: Why tvb_get_bits() assumes Big Endian? Jaap Keuter (Jul 29)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 29)
- Re: Why tvb_get_bits() assumes Big Endian? Roland Knall (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Graham Bloice (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Graham Bloice (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Jaap Keuter (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 29)
- Re: Why tvb_get_bits() assumes Big Endian? Jaap Keuter (Jul 29)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Jaap Keuter (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Filipe Laíns (Jul 30)
- Re: Why tvb_get_bits() assumes Big Endian? Tomasz Moń (Jul 30)