[Next] [Up] [Previous] [Contents]
Next: Vector assignments Up: Vectors and vector operators Previous: Coercion of array variables

Binary subranges

A binary variable may be explicitly coerced to a vector by specifying a subrange of bit indices. For example, the expression

        x[2..5]
is equivalent to

        [x[2],x[3],x[4],x[5]]

Similarly,

        x[5..2]
is equivalent to

        [x[5],x[4],x[3],x[2]]

Subranges may be used, for example, to extract bitfields, or to reverse the declared order bits in an array.



Ken McMillan
Sat Jun 6 21:41:59 PDT 1998