Revision history [back]

As I mentioned in the comment to this question, the answer is:

subtree:add_le(somefield, buffer(94, 2), buffer(94, 2):le_uint() * x)


NOTE: Because you're specifying the value to use, it doesn't make any difference if you use subtree:add() or subtree:add_le(), but if your protocol is Little-Endian, then it's better to be consistent and use subtree:add_le().

Also, since you're using the entire value, there's no need to specify a mask; you can just use:

somefield = ProtoField.uint16("foo.somefield", "Some Field", base.DEC)