Ask Your Question

Revision history [back]

You want bit 1 set and bits 2 & 3 clear, so mask (bitwise and) with 0x07 to isolate those three bits and then test if the result is equal to 1 indicating only the first bit is set:

(rtp.ext.rfc5285.data[0] & 0x07) == 1

You want bit 1 set and bits 2 & 3 clear, so mask (bitwise and) with 0x07 to isolate those three bits and then test if the result is equal to 1 indicating only the first bit is set:

(rtp.ext.rfc5285.data[0] & 0x07) == 1
0x01) and !(rtp.ext.rfc5285.data[0] &0x06)

You want bit 1 set and bits 2 & 3 clear, so mask (bitwise and) with 0x07 0x01 to isolate those three bits and then test if the result is equal to 1 indicating only the first bit is set:and then mask with 0x06 to test the 2nd and 3rd bits, but negating the result:

(rtp.ext.rfc5285.data[0] & 0x01) and !(rtp.ext.rfc5285.data[0] &0x06)
& 0x06)