← Back to team overview

rohc team mailing list archive

ROHC interval detrmination for 16 and 8 bits fields

 

Hi,

In below highlighted lines shouldn't we AND with 0xffff instead of 0xfffff
to ensure if the value is not greater than 0xffff.

it would be great if you can explain with an example to correct my
understanding.

struct rohc_interval16 rohc_f_16bits(const uint16_t v_ref,
                                     const size_t k,
                                     const rohc_lsb_shift_t p)
{
struct rohc_interval32 interval32;
struct rohc_interval16 interval16;

/* do not accept more bits than the field may contain */
assert(k <= 16);

/* use the function for 32-bit fields, then ensure that nothing is greater
* than 0xffff */
interval32 = rohc_f_32bits(v_ref, k, p);
* interval16.min = interval32.min & 0xfffff;*
* interval16.max = interval32.max & 0xfffff;*

return interval16;
}


Thanks and Regards,
Deepak

Follow ups