~sircmpwn/hare-specification unlisted

71fecf47a00bfd4515995ff440acf6cffdce23bc — Thomas Bracht Laumann Jespersen a month ago fce3ff3
expressions: Specify that signedness matter for ">>"

This expands the definition of the right-shift operator (>>) to specify
that signedness of the shift-expression is taken into account.

Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
1 files changed, 8 insertions(+), 5 deletions(-)

M language/expressions.tex
M language/expressions.tex => language/expressions.tex +8 -5
@@ 1235,11 1235,14 @@ be zero.
\nonterminal{shift-expression} by $2^N$}

\specsubsubitem
\code{\nonterminal{shift-expression} \terminal{\textgreater{}\textgreater{}} $N$} shall shift
each bit towards the least significant bit $N$ places, and set the most
significant $N$ bits to zero. The $N$ least significant bits shall be silently
discarded. If $N$ is greater than the size in bits of the type, the result shall
be zero.
\code{\nonterminal{shift-expression} \terminal{\textgreater{}\textgreater{}}
$N$} shall shift each bit towards the least significant bit $N$ places. The most
significant bits shall be set to either zero or one depending on the signedness
of \nonterminal{shift-expression}: If it is signed, then the $N$ most
significant bits shall be set to the value of the sign bit. If it unsigned, then
the $N$ most significant bits shall be set to zero. The $N$ least significant
bits shall be silently discarded. If $N$ is greater than the size in bits of the
type, the result shall be zero.

\informative{This operation is equivalent to dividing
\nonterminal{shift-expression} by $2^N$}