19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

40.6.10 update(j:IndexInt, v: Bit):<br />

BinaryEndianWordb,bigEndianBytes,bigEndianBits<br />

throws { IndexOutOfBoundsException }<br />

40.6.11 updatenat k(j:IntegerStatick, v: Bit):<br />

BinaryEndianWordb,bigEndianBytes,bigEndianBits<br />

where { k < 2 b }<br />

This is a functional version of subscripted value object assignment: the bit that would be selected from the result by<br />

subscripting it with j is the same as the given bit v , and all other bits are the same as before. Indexing is zero-origin; an<br />

IndexOutOfBoundsException is thrown unless 0 ≤ j < 2 b . If the subscript is a static expression, then its validity<br />

is checked statically, and no exception will occur at run time.<br />

40.6.12 updatenat m(r:RangeOfStaticSizeIndexInt, m, v:BinaryLinearSequence1, m):<br />

BinaryEndianWordb,bigEndianBytes,bigEndianBits<br />

throws { IndexOutOfBoundsException }<br />

40.6.13 updateint a,nat m,int c(r:StaticRangea, m, c, v:BinaryLinearSequence1, m):<br />

BinaryEndianWordb,bigEndianBytes,bigEndianBits<br />

where { 0 ≤ a < 2 b , 0 ≤ a + m · c < 2 b }<br />

This is a functional version of subscripted value object assignment: bits that would be selected from the result by<br />

subscripting it with r are the same as corresponding elements of v , and all other bits are the same as before; specifically,<br />

the bit that would be selected from the result by subscripting it with r.lowerBound + k × r.stride is the same<br />

as element k of v , for all 0 ≤ k < m . Indexing is zero-origin; an IndexOutOfBoundsException is thrown unless<br />

r ⊆ 0 #2 b . If the subscript is a static range, then its validity is checked statically, and no exception will occur at run<br />

time.<br />

40.6.14 lowHalf ():BinaryEndianWordb − 1,bigEndianBytes,bigEndianBits where { b > 0 }<br />

40.6.15 highHalf ():BinaryEndianWordb − 1,bigEndianBytes,bigEndianBits where { b > 0 }<br />

<strong>The</strong> getters lowHalf and highHalf each return a binary endian word of half the size (in bits) of this binary endian<br />

word, and with the same endian characteristics; lowHalf returns the less significant bits, and highHalf returns the<br />

more significant bits.<br />

∧<br />

property ∀(v) v.lowHalf .bit(m) = v.bit(m)<br />

m←0#2 ∧<br />

b−1<br />

property ∀(v) v.highHalf .bit(m) = v.bit(m + 2 b−1 )<br />

m←0#2 ∧<br />

b−1<br />

property ∀(v) v.lowHalf m = v[if bigEndianBits then m + 2 b−1 else m end]<br />

m←0#2 ∧<br />

b−1<br />

property ∀(v) v.highHalf m = v[if bigEndianBits then m else m + 2 b−1 end]<br />

m←0#2 b−1<br />

286

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!