Is one's complement a real-world issue, or just a historical one?

后端 未结 9 842
广开言路
广开言路 2020-11-29 04:53

Another question asked about determining odd/evenness in C, and the idiomatic (x & 1) approach was correctly flagged as broken for one\'s complement-based systems, which

9条回答
  •  心在旅途
    2020-11-29 05:01

    Is one's complement a real-world issue, or just a historical one?

    Yes, it still used. Its even used in modern Intel processors. From Intel® 64 and IA-32 Architectures Software Developer’s Manual 2A, page 3-8:

    3.1.1.8 Description Section

    Each instruction is then described by number of information sections. The “Description” section describes the purpose of the instructions and required operands in more detail.

    Summary of terms that may be used in the description section:
    * Legacy SSE: Refers to SSE, SSE2, SSE3, SSSE3, SSE4, AESNI, PCLMULQDQ and any future instruction sets referencing XMM registers and encoded without a VEX prefix.
    * VEX.vvvv. The VEX bitfield specifying a source or destination register (in 1’s complement form).
    * rm_field: shorthand for the ModR/M r/m field and any REX.B
    * reg_field: shorthand for the ModR/M reg field and any REX.R

提交回复
热议问题