Skip to content

Commit bef02b8

Browse files
committed
[expr.unary.op] Notes naming unary ops as {ones',two's} complement
The terms "one's complement" and "two's complement" are well-known, and it is useful to associate them with these operators.
1 parent c88fb46 commit bef02b8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/expressions.tex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4653,6 +4653,10 @@
46534653
of an unsigned quantity is computed by subtracting its value from $2^n$,
46544654
where $n$ is the number of bits in the promoted operand. The type of the
46554655
result is the type of the promoted operand.
4656+
\begin{note}
4657+
The result is the two's complement of the operand
4658+
(where operand and result are considered as unsigned).
4659+
\end{note}
46564660

46574661
\pnum
46584662
\indextext{operator!logical negation}%
@@ -4674,6 +4678,10 @@
46744678
the coefficient $\tcode{r}_i$
46754679
of the base-2 representation of the result \tcode{r}
46764680
is 1 if $\tcode{x}_i$ is 0, and 0 otherwise.
4681+
\begin{note}
4682+
The result is the ones' complement of the operand
4683+
(where operand and result are considered as unsigned).
4684+
\end{note}
46774685
There is an ambiguity
46784686
in the grammar when \tcode{\~{}} is followed by
46794687
a \grammarterm{type-name} or \grammarterm{decltype-specifier}.

0 commit comments

Comments
 (0)