For Variable-length extracts, it is strongly recommended to make the granularity as coarse as possible to minimize utilization. For example, many header formats are in multiples of 16, 32 or 64 bits. The variable length extract should be coded explicitly with this multiplier in place. This is particularly important when the variable length information is coming from input metadata. e.g.
packet.extract(hdr.ipv4opt, (((bit<32>)hdr.ipv4.hdr_len -
5) * 32));