Next: , Previous: , Up: Offsets   [Contents][Index]

14.2.3 Offset Types

Offset types are denoted as offset<base_type,unit>, where base_type is an integer type and unit the specification of an unit.

The offset base type is the type of the magnitude part of the united value. It can be any integer type, signed or unsigned, of any size.

The unit specification should be one of the unit identifiers that are allowed in offset literals (see above), a constant positive integer or the name of a Poke type whose size is known at compile time.

Let’s see some examples. A signed 32-bit offset expressed in bytes has type offset<int<32>,B>. An unsigned 12-bit offset expressed in kilobits has type offset<uint<12>,Kb>. The latter type can also be written using an explicit integer unit like in offset<uint<12>,1024>. Finally, a signed 64-bit offset in units of “packets”, where a packet is denoted with a Poke type Packet has type offset<uint<64>,Packet>.