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


14.2.1 Offset Literals

Poke provides a convenient syntax to provide united values, which are called offsets (because in a binary editor you mostly use them to denote offsets in the file you are editing):

12#B
7#b
1024#KB

The offsets above denote twelve bytes, seven bits and one thousand twenty four kilobytes, respectively. The unit can be separated from the magnitude by blank characters, so you can write the following instead if you are so inclined:

12 #B
7 #b
(1024 * 1024) #Kb

Note how the magnitude part of an offset doesn’t need to be constant. If the variable a contains an integer, this is how you would denote “a bytes”:

a#B

In the offset syntax units are specified as #unit, where unit is the specification of an unit. See the next section for details.