Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] Display Filter setting - Odd/Even packets

From: Sake Blok <sake@xxxxxxxxxx>
Date: Thu, 13 Dec 2007 16:29:28 +0100
On Thu, Dec 13, 2007 at 02:19:15PM -0000, Keith French wrote:
> What does the use of the single ampersand (&) do in the last part of the 
> filter:-
> 
> frame.number & 1
> 
> I can't find this documented, only the && for AND?

It will take the value of frame.number and *bitwise* "and" this value
with the value "1".

So, the result would be:

frame 1 (00000001) & 1 (00000001) -> 1
frame 2 (00000010) & 1 (00000001) -> 0
frame 3 (00000011) & 1 (00000001) -> 1
etc.

The value 0 is considered as FALSE and the value 1 as TRUE.

It can also be written as "frame.number & 1 == 1" which is a little
more verbose and intuitive, but then again, it takes more keystrokes ;-)

Cheers,
    Sake