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.

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

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

opr ‖ nat m,bool bigEndianSequence<br />

(self,other: BinaryEndianWordb,bigEndianBytes,bigEndianBits):<br />

BinaryEndianLinearEndianSequenceb + 1,bigEndianBytes,bigEndianBits,<br />

2,bigEndianSequence<br />

where {bigEndianSequence = bigEndianBytes }<br />

opr ‖ nat m,bool bigEndianSequence,nat radix,nat q,nat k,nat v<br />

(self,other: NaturalNumeralm,radix, v):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

k + 1,bigEndianSequence<br />

where {bigEndianSequence = bigEndianBytes,radix = 2 q , q · m = k · 2 b }<br />

opr ‖ nat m,bool bigEndianSequence,nat radix,nat q,nat k,nat v<br />

(other: NaturalNumeralm,radix, v,self):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

k + 1,bigEndianSequence<br />

where {bigEndianSequence = bigEndianBytes,radix = 2 q , q · m = k · 2 b }<br />

bitShuffle(other: BinaryEndianWordb,bigEndianBytes,bigEndianBits):<br />

BinaryEndianWordb + 1,bigEndianBytes,bigEndianBits<br />

where { b < maxBinaryWordBitLog }<br />

bitUnshuffle():(BinaryEndianWordb − 1,bigEndianBytes,bigEndianBits,<br />

BinaryEndianWordb − 1,bigEndianBytes,bigEndianBits)<br />

where { b > 0 }<br />

littleEndian():BinaryEndianWordb,false,false<br />

bigEndian():BinaryEndianWordb,true,true<br />

end<br />

40.6.1 coercion int r(x:IntegerStaticr) where { −2 b−1 ≤ r < 2 b }<br />

An static integer may be coerced to a binary endian word exactly as if it were coerced to a plain binary word of the<br />

same size; the endian numbering of the bytes and bits does not affect which binary word value is produced from the<br />

static integer.<br />

40.6.2 opr [j: IndexInt] : BinaryEndianWord1,bigEndianBytes,bigEndianBits<br />

throws { IndexOutOfBoundsException }<br />

40.6.3 opr nat k[j: IntegerStatick] : BinaryEndianWord1,bigEndianBytes,bigEndianBits<br />

where { k < 2 b }<br />

Subscripting returns bit j of this binary endian word. <strong>The</strong> numbering of the bits is dictated by bigEndianBits .<br />

Indexing is zero-origin; an IndexOutOfBoundsException is thrown unless 0 ≤ j < 2 b . If the subscript is a static<br />

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

∧<br />

property ∀(v) v j = (if bigEndianBits then v.bit(2 b − 1 − j) else v.bit(j) end)<br />

j←0#2 b<br />

284

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

Saved successfully!

Ooh no, something went wrong!