[ovs-discuss] Can anyone familiar with the following code please clarify for me?

Ben Pfaff blp at nicira.com
Tue May 22 06:15:26 UTC 2012

On Tue, May 22, 2012 at 02:11:35PM +0800, YIMIN CHEN wrote:
> I am working on ovs code based on openvswitch-1.1.0pre2, it is kinda
> of old, I know. I ran across this code that I am having hard time
> understanding. If anyone is familiar with this part of code, could you
> please help me?
>    if (!(field_wc & (field_wc - 1))) { <================== if field_wc

The expression '!(x & (x - 1))' is true if exactly one bit in 'x' is set
to 1 (or if x is zero).

More information about the discuss mailing list