|
|
|
2.2 Values WebAssembly programs operate on primitive numeric values . Moreover, in the definition of programs, immutable sequences of values occur to represent more complex data, such as text strings or other vectors. 2.2.1 Bytes The simplest form of value are raw uninterpreted bytes . In the abstract syntax they are represented as hexadecimal literals. ::= 0x00 | . . . | 0xFF Conventions • The meta variable 𝑏 ranges over bytes. • Bytes are sometimes interpreted as natural numbers 𝑛 < 256 . 2.2.2 Integers Different classes of integers with different value ranges are distinguished by their bit width 𝑁 and by whether they are unsigned or signed . ::= 0 | 1 | . . . | 2 𝑁 − 1 ::= − 2 𝑁 − 1 | . . . | − 1 | 0 | 1 | . . . | 2 𝑁 − 1 − 1 ::= The latter class defines uninterpreted integers, whose signedness interpretation can vary depending on context. In the abstract syntax, they are represented as unsigned values. However, some operations them to signed based on a two’s complement interpretation. Note: The main integer types occurring in this specification are . However, other sizes occur as auxiliary constructions, e.g., in the definition of numbers. Conventions • The meta variables 𝑚, 𝑛, 𝑖 range over integers. • Numbers may be denoted by simple arithmetics, as in the grammar above. In order to distinguish arithmetics like 2 𝑁 from sequences like (1) 𝑁 , the latter is distinguished with parentheses. 2.2.3 Floating-Point Floating-point data represents 32 or 64 bit values that correspond to the respective binary formats of the standard (Section 3.3). Every value has a sign and a magnitude . Magnitudes can either be expressed as normal numbers of the form 𝑚 0 .𝑚 1 𝑚 2 . . . 𝑚 𝑀 · 2 𝑒 , where 𝑒 is the exponent and 𝑚 is the significand whose most significant bit 𝑚 0 is 1 , or as a subnormal number where the exponent is fixed to the smallest possible value and 𝑚 0 is 0 ; among the subnormals are positive and negative zero values. Since the significands are binary values, normals are represented in the form (1 + 𝑚 · 2 − 𝑀 ) · 2 𝑒 , where 𝑀 is the bit width of 𝑚 ; similarly for subnormals. 9 https://ieeexplore.ieee.org/document/8766229 2.2. Values 7 |