본문 바로가기
csapp

2.2.2 Unsigned Encodings

by 정구지개발자 2023. 4. 2.
728x90
  • 0 is nonnegative, this means that it can represent one less positive number than negative. Second, the maximum unsigned value is just over twice the maximum two’s-complement value: UMax = 2TMax + 1.
  •  

  • Programmers who are concerned with maximizing portability across all possible machines should not assume any particular range of representable values, beyond the ranges indicated in Figure 2.11, nor should they assume any particular representation of signed numbers. On the other hand, many programs are written assuming a two’s-complement representation of signed numbers, and the “typical” ranges shown in Figures 2.9 and 2.10, and these programs are portable across a broad range of machines and compilers.

2.2.4 Conversions between Signed and Unsigned

  • Converting an unsigned value that is too large to be represented in two’s- complement form might yield TMax. For most implementations of C, however, the answer to this question is based on a bit-level perspective, rather than on a numeric one.
  • Casting from short to unsigned short changed the numeric value, but not the bit representation.
728x90

'csapp' 카테고리의 다른 글

2.2.8 Advice on Signed versus Unsigned  (0) 2023.04.05
2.2.5 Signed versus Unsigned in C  (0) 2023.04.04
2.1.7 Bit-Level Operations in C  (0) 2023.03.31
2.1.3 Addressing and byte Ordering  (0) 2023.03.30
2 Representing and Manipulating Information  (0) 2023.03.28

댓글