See How Things Work

Unsigned integers

Unit
Representing Information
Part
2. Numbers in a Computer
Lesson
2.1

An unsigned integer is a whole number kept in a fixed number of bits and read as a binary numeral. This lesson defines the value of an n-bit pattern and its range, 0 to 2ⁿ − 1, compares unsigned integers, changes their width, and adds them with carries, proving that the sum of two n-bit numbers can need n + 1 bits but never more.

Unsigned integers

Lesson 1.3 stored a whole number in a computer as its n-bit pattern: its binary numeral with zeros written on the left until it has exactly n bits. This part of the unit looks at the kinds of number that machines keep in such patterns. The simplest kind reads the pattern exactly as a binary numeral.

Definition (Unsigned integer).

Let n ≥ 1. An n-bit unsigned integer is a pattern of n bits b₍ₙ₋₁₎ … b₁b₀, read as a binary numeral: its value is

b₍ₙ₋₁₎ × 2ⁿ⁻¹ + ⋯ + b₁ × 2 + b₀.

The value is a whole number, never negative: an unsigned integer starts from 0 and is read in the same way as a decimal numeral, with 2 in place of 10.⁠[1] Intel’s manuals describe unsigned integers as ordinary binary values from 0 up to the largest number the width can hold,⁠[2] and also call them ordinals.⁠[3]

The word “unsigned” says what is missing: there is no sign, so no pattern stands for a negative number. Negative numbers need a different reading of the bits, the subject of the next lesson.

Proposition 1 (the range).

The n-bit unsigned integers have exactly the values 0, 1, …, 2ⁿ − 1, and each of these values has exactly one pattern.

Proof.

This is Proposition 1 of lesson 1.5: the 2ⁿ patterns of n bits, read as binary numerals, name exactly the numbers 0 to 2ⁿ − 1, by the theorem “what k bits can name” of Number Bases lesson 1.2. Different patterns name different numbers, and the n-bit pattern of lesson 1.3 is the one pattern of each number.

The sources state the same range: n bits can present 2ⁿ values, from 0 to 2ⁿ − 1, none of them negative;⁠[4] the C programming language standard gives the range of an unsigned type of width N as 0 to 2ᴺ − 1;⁠[5] and Intel’s processors hold unsigned integers from 0 to 255 in a byte, 0 to 65,535 in a word of 16 bits, 0 to 2³² − 1 in a doubleword and 0 to 2⁶⁴ − 1 in a quadword.⁠[6][3][7]

Width nIntel’s nameLargest, 2ⁿ − 1In hexadecimal
8byte2550xFF
16word65,5350xFFFF
32doubleword4,294,967,2950xFFFFFFFF
64quadword18,446,744,073,709,551,6150xFFFFFFFFFFFFFFFF
Table. The four widths of Intel’s unsigned integers, with Intel’s names for them,⁠[6][7] and the largest unsigned integer of each width. In hexadecimal (lesson 1.4) the largest value is written with Fs only, one F for every four bits.
Example (Reading an unsigned byte).

What is the value of the 8-bit unsigned integer 10110010?

  1. From the right, the positions are 0 to 7. The 1s stand in positions 7, 5, 4 and 1.
  2. The value is 2⁷ + 2⁵ + 2⁴ + 2¹ = 128 + 32 + 16 + 2 = 178.

Answer: 178. Check in hexadecimal: 1011 0010 is 0xB2 = 11 × 16 + 2 = 178.

Example (Sixteen bits through hexadecimal).

What is the value of the 16-bit unsigned integer 0xA7F3, and what are its bits?

  1. Each digit is one nibble: A = 1010, 7 = 0111, F = 1111 and 3 = 0011, so the bits are 1010011111110011.
  2. The places of the four digits are worth 4,096, 256, 16 and 1: 10 × 4,096 + 7 × 256 + 15 × 16 + 3 = 40,960 + 1,792 + 240 + 3.

Answer: 42,995, with the bits 1010011111110011. It lies between 0 and 65,535, as Proposition 1 requires for 16 bits.

Example (The edge cases: the ends and the middle of a range).

Give the values of the 16-bit unsigned integers 0x0000, 0xFFFF, 0x7FFF and 0x8000.

  1. 0x0000 is sixteen 0s: the value 0, the smallest.
  2. 0xFFFF is sixteen 1s: 2¹⁶ − 1 = 65,535, the largest (lesson 1.3).
  3. 0x7FFF is a 0 followed by fifteen 1s: 2¹⁵ − 1 = 32,767.
  4. 0x8000 is a 1 followed by fifteen 0s: 2¹⁵ = 32,768.

Answer: 0, 65,535, 32,767 and 32,768. The last two are neighbors, and between them the most significant bit changes from 0 to 1, as Proposition 1 of lesson 1.3 says it must at 2ⁿ⁻¹. That boundary matters again in the next lesson.

Comparing unsigned integers

Two unsigned integers of the same width can be compared without working out their values: only the leftmost position where they differ matters.

Proposition 2 (the leftmost difference decides).

Let P and Q be different n-bit patterns, and let k be the leftmost position in which they differ. If P has the 1 in position k, then P is the larger unsigned integer.

Proof.

The bits to the left of position k are the same in both patterns and add the same amount to both values. In position k, P has a 1, worth 2ᵏ, and Q a 0. The bits to the right of position k add at least 0 and at most 1 + 2 + ⋯ + 2ᵏ⁻¹ = 2ᵏ − 1 (Number Bases lesson 1.2, Exercise 6) to either value; when k = 0 there are no such bits, and 2⁰ − 1 = 0. So P exceeds Q by at least 2ᵏ − (2ᵏ − 1) = 1.

Example (A common mistake: counting the 1s).

Which 8-bit unsigned integer is larger, 01111111 or 10000000? The first has seven 1s and the second only one.

  1. The leftmost position where they differ is position 7, and there the second pattern has the 1.
  2. By Proposition 2 the second is larger: 10000000 = 128 and 01111111 = 127.

Answer: 10000000. The number of 1s says nothing about the size; the place of the leftmost 1 does.

Example (Comparing in hexadecimal).

Which is larger, 0xA7F3 or 0xA80F?

  1. The first digits agree (A); the second digits are 7 = 0111 and 8 = 1000.
  2. So the patterns first differ in the leftmost bit of the second nibble, and 0xA80F has the 1 there.

Answer: 0xA80F. Check: 0xA80F = 40,960 + 2,048 + 15 = 43,023, and 0xA7F3 = 42,995.

Changing the width

The same number is often moved between fields of different widths, for example from a byte into 32 bits, or back. Widening is easy: the zeros written on the left change nothing (lesson 1.3). Writing zeros into the new positions is called zero extension; the Java language specification, for example, says that a widening conversion of its 16-bit unsigned type zero-extends the representation to fill the wider format.⁠[8][9]

Narrowing keeps only the rightmost bits. What it keeps is a remainder, as lesson 1.3 found for the low byte of a 16-bit number.

Theorem 3 (the low bits are a remainder).

Let 1 ≤ m < n and let x be an n-bit unsigned integer. The rightmost m bits of x, read as an m-bit unsigned integer, name the remainder r of x ÷ 2ᵐ, and the other n − m bits name the quotient q: x = q × 2ᵐ + r with 0 ≤ r < 2ᵐ.

Proof.

A 1 in position m + j of x is worth 2ᵐ⁺ʲ = 2ᵐ × 2ʲ, grouping factors as in the proof of Proposition 2 of lesson 1.3. In the left part, read on its own, the same bit stands in position j and is worth 2ʲ. So the left part contributes 2ᵐ × q to x, by the distributive property, and the right part contributes its own value r. Since r has m bits, 0 ≤ r ≤ 2ᵐ − 1 < 2ᵐ. So x = q × 2ᵐ + r is the division of x by 2ᵐ, with quotient q and remainder r (the division algorithm).

101 = 5quotient10110 = 22remainder1706151403121100182 = 5 × 32 + 22
Figure. The 8-bit unsigned integer 182 = 10110110 cut after its high 3 bits. The low 5 bits, 10110, name 22, the remainder of 182 ÷ 32; the high 3 bits, 101, name 5, the quotient: 182 = 5 × 32 + 22.

So narrowing to m bits keeps x unchanged exactly when x < 2ᵐ, that is, when the quotient is 0. Otherwise it loses q × 2ᵐ. The C standard states the same rule in another form: a value converted to an unsigned type that cannot hold it is changed by repeatedly adding or subtracting one more than the type’s largest value until it is in range.⁠[10] For a whole number x that is too large, “one more than the largest value” is 2ᵐ, and subtracting it q times leaves exactly the remainder r.

Example (Narrowing a number that fits, and one that does not).

The 16-bit unsigned integers 0x0064 and 0x012C are narrowed to 8 bits. What do the bytes hold?

  1. 0x0064 = 100: its low byte is 0x64 = 100. The high byte was 0, so nothing is lost.
  2. 0x012C = 256 + 32 + 12 = 300: its low byte is 0x2C = 44. Indeed 300 = 1 × 256 + 44.

Answer: 100, unchanged, and 44 in place of 300. The second value lost one 256, the part that a byte cannot hold.

Adding unsigned integers

Number Bases lesson 1.4 proved that two numerals of any base are added in columns from the right, each column writing one digit and carrying 0 or 1 to the next. In binary, a column that holds 2 or 3 writes 0 or 1 and carries 1. Two n-bit numbers have n columns, and the carry out of the last column becomes the leading bit of the sum.⁠[11]

Definition (Carry out).

When two n-bit unsigned integers are added in columns, the carry out of the leftmost column, position n − 1, is the carry out of the addition. Processors record it: Intel’s carry flag is set when an arithmetic operation generates a carry out of the most significant bit of the result.⁠[12]

Theorem 4 (the sum of two n-bit numbers).

Let x and y be n-bit unsigned integers.

  1. x + y ≤ 2ⁿ⁺¹ − 2. So the sum always has an (n + 1)-bit pattern: the carry out followed by the n bits written in the columns.
  2. The sum fits in n bits exactly when the carry out is 0, that is, when x + y ≤ 2ⁿ − 1.
  3. When the carry out is 1, the n bits written in the columns name x + y − 2ⁿ.
  4. n + 1 bits are sometimes needed, but never more: (2ⁿ − 1) + (2ⁿ − 1) = 2ⁿ⁺¹ − 2 has exactly n + 1 bits.
Proof.

(1) x and y are at most 2ⁿ − 1, so x + y ≤ 2ⁿ⁺¹ − 2, which is less than 2ⁿ⁺¹; by the theorem “what k bits can name” with k = n + 1, the sum has an (n + 1)-bit pattern. By the column theorem of Number Bases lesson 1.4, the n columns write n bits, and the last carry becomes the bit in position n.

(2) By Proposition 1 of lesson 1.3, the leftmost bit of the (n + 1)-bit pattern, which is the carry out, is 1 exactly when x + y ≥ 2ⁿ.

(3) By Theorem 3, with n + 1 bits in place of n and m = n, the low n bits name the remainder of (x + y) ÷ 2ⁿ. When the carry out is 1, 2ⁿ ≤ x + y < 2 × 2ⁿ, so the quotient is 1 and the remainder is x + y − 2ⁿ.

(4) (2ⁿ − 1) + (2ⁿ − 1) = 2 × 2ⁿ − 2 = 2ⁿ⁺¹ − 2 is at least 2ⁿ (for n ≥ 1), so by part (2) it needs the carry out; by part (1) no sum needs more than n + 1 bits.

out7654321011+1100100001100100100101100carry out8 bits kept: 00101100 = 44200 + 100 = 300 = 256 + 44
Figure. 200 + 100 in 8-bit columns. Positions 6 and 7 each reach 2 and carry 1, shown in amber above the next column to the left; the carry out of position 7 is 1, so the sum, 100101100 = 300, needs 9 bits. The 8 bits written in the columns, 00101100, name 44 = 300 − 256, as Theorem 4 (3) says.
Example (A sum that fits).

Add the 8-bit unsigned integers 01101100 = 108 and 00100111 = 39.

  1. Positions 0 and 1: 0 + 1 = 1, no carry.
  2. Position 2: 1 + 1 = 2, write 0, carry 1. Position 3: 1 + 0 + 1 = 2, write 0, carry 1. Position 4: 0 + 0 + 1 = 1.
  3. Position 5: 1 + 1 = 2, write 0, carry 1. Position 6: 1 + 0 + 1 = 2, write 0, carry 1. Position 7: 0 + 0 + 1 = 1, no carry.

Answer: 10010011, with carry out 0, so the sum fits in 8 bits. Check: 108 + 39 = 147 = 128 + 16 + 2 + 1.

Example (A sum that needs a ninth bit).

Add 11001000 = 200 and 01100100 = 100 in 8 bits, as in the figure.

  1. Positions 0 to 5 have at most one 1 each and no carry comes in: they write 0, 0, 1, 1, 0, 1 from position 0 up.
  2. Position 6: 1 + 1 = 2, write 0, carry 1. Position 7: 1 + 0 + 1 = 2, write 0, carry 1.
  3. The carry out is 1: the sum is 100101100.

Answer: 300 = 100101100 needs 9 bits. The 8 bits alone, 00101100, name 44 = 300 − 256, as Theorem 4 (3) predicts.

Example (Sixteen bits in hexadecimal).

Add the 16-bit unsigned integers 0xC350 = 50,000 and 0x4E20 = 20,000.

  1. Add digit by digit from the right, carrying at 16 (Number Bases lesson 1.4): 0 + 0 = 0; 5 + 2 = 7.
  2. 3 + E = 3 + 14 = 17 = 16 + 1: write 1, carry 1. C + 4 + 1 = 12 + 5 = 17: write 1, carry 1.
  3. The last carry is the carry out: the sum is 0x11170.

Answer: 70,000 = 0x11170 needs 17 bits; the 16 bits alone, 0x1170, name 4,464 = 70,000 − 65,536. A carry out of the leftmost hexadecimal digit is the carry out of the leftmost bit, because each digit is four bits.

Example (The edge cases: the largest sums).

Add 11111111 + 11111111 and 11111111 + 00000001 in 8 bits.

  1. First sum: position 0 holds 1 + 1 = 2, writes 0 and carries 1; every other position holds 1 + 1 + 1 = 3, writes 1 and carries 1. The sum is 111111110 = 510 = 2⁹ − 2.
  2. Second sum: position 0 holds 1 + 1 = 2; every other position holds 1 + 0 + 1 = 2. Each writes 0 and carries 1, and the carry runs through all eight columns: the sum is 100000000 = 256.

Answer: 510 and 256, both 9 bits. 510 is the largest sum of two bytes (Theorem 4 (4)); 255 + 1 is the smallest sum that needs the ninth bit, and in 8 bits it leaves 00000000.

Example (A common mistake: the largest value as the result).

Someone adds 200 and 100 in a byte and says that the byte must hold 255, “the largest value it can”. What does it really hold?

  1. The column addition does not stop at 255: it writes its 8 bits and a carry out, whatever the size of the sum.
  2. By Theorem 4 (3) the 8 bits name 300 − 256 = 44, as in the figure.

Answer: 44, not 255. Column addition never replaces a sum by the largest value; it drops the carry out, which is worth 2ⁿ. Some processors also have special instructions that do stop at the largest value: with Intel’s unsigned saturation arithmetic, a byte result that is too large comes out as 0xFF.⁠[13] Ordinary addition does not do this. What all this means for programs is the subject of this unit’s lesson “Overflow”.

Game

Add in columns

Round
1
Score
0
Streak
0

Add these two 8-bit unsigned integers in columns, 01001001 = 73 and 11010010 = 210. Set the 9 bits of the sum: the leftmost switch is the carry out of position 7.

Top row: the positions; “out” is the carry out. After Check, the carries are shown in amber.

Subtracting, and where unsigned integers stop

Column subtraction (Number Bases lesson 1.4) works for x − y whenever x ≥ y, and then x − y is again an n-bit unsigned integer, since 0 ≤ x − y ≤ x. When x < y, the difference is negative, and no unsigned integer has that value. Intel’s carry flag records this case as well: it is set by a borrow out of the most significant bit, and it signals an overflow condition for unsigned arithmetic.⁠[12]

Example (Subtracting a larger number).

In 8 bits, compute 00000011 − 00000101 (3 − 5) by imagining a 1 in position 8, worth 2⁸ = 256, to borrow from. What bits result?

  1. With the imagined 1, the top number is 256 + 3 = 259 = 100000011, and 259 − 5 = 254 is an ordinary subtraction.
  2. 254 = 11111110. The imagined bit has been used up: it was the borrow out of position 7.

Answer: the 8 bits 11111110, which name 254 = 256 + (3 − 5) as an unsigned integer, not −2. The next lesson shows a way of reading exactly these bits as −2.

Unsigned integers suit quantities that cannot be negative: counts, sizes and memory addresses (lesson 1.5). The POSIX standard for operating systems, for example, has a type size_t for the sizes of objects,⁠[14] and requires it to be an unsigned integer type.⁠[15] As one textbook puts it, with unsigned integers there are no negative numbers, and to present negative numbers, signed numbers are needed.⁠[4]

Looking ahead.

Negative integers are the next lesson, “Negative integers and two’s complement”. Sums that need the carry out, and differences that need the borrow, are studied in “Overflow”. Fractions in bits come in “Fixed-point numbers”. How a processor adds, with circuits called adders, belongs to the unit Digital Logic & Computer Hardware.

Exercises

Exercise .

Give the values of the unsigned integers (a) 00011001 and (b) 11100000 (8 bits), (c) 0xF00F (16 bits) and (d) 0xABC (12 bits).

▸ Show solution

(a) 00011001: positions 4, 3 and 0, so 16 + 8 + 1 = 25.

(b) 11100000: 128 + 64 + 32 = 224.

(c) 0xF00F = 15 × 4,096 + 0 + 0 + 15 = 61,440 + 15 = 61,455.

(d) 0xABC = 10 × 256 + 11 × 16 + 12 = 2,560 + 176 + 12 = 2,748; 12 bits can hold up to 4,095, so it fits.

Exercise .

An unsigned field must hold every value from 0 to 1,023. How wide must it be? Write 1,000 in that width.

▸ Show solution

0 to 1,023 are 1,024 = 2¹⁰ values (lesson 1.5), so 10 bits. 1,000 = 512 + 256 + 128 + 64 + 32 + 8 = 1111101000, which has exactly 10 bits.

Exercise .

Without converting to decimal, decide which 8-bit unsigned integer is larger, 01101101 or 01011111. Then check.

▸ Show solution

Reading from the left, positions 7 and 6 agree (0 and 1 in both); position 5 is the first difference, where 01101101 has the 1. So 01101101 is larger by Proposition 2. Check: 01101101 = 64 + 32 + 8 + 4 + 1 = 109 and 01011111 = 64 + 16 + 8 + 4 + 2 + 1 = 95.

Exercise .

The 16-bit unsigned integer 0xBEEF is narrowed to 8 bits, and separately to 4 bits. What values remain? Check each with Theorem 3.

▸ Show solution

0xBEEF = 11 × 4,096 + 14 × 256 + 14 × 16 + 15 = 45,056 + 3,584 + 224 + 15 = 48,879. Narrowed to 8 bits it keeps 0xEF = 239, and by Theorem 3, 48,879 = 190 × 256 + 239 (190 = 0xBE).

Narrowed to 4 bits it keeps 0xF = 15, and 48,879 = 3,054 × 16 + 15.

Exercise .

Add the 8-bit unsigned integers 10011010 = 154 and 01111001 = 121 in columns. Does the sum fit in 8 bits?

▸ Show solution

Positions 0 to 2: 0 + 1 = 1, 1 + 0 = 1, 0 + 0 = 0. Position 3: 1 + 1 = 2, write 0, carry 1. Position 4: 1 + 1 + 1 = 3, write 1, carry 1. Positions 5, 6 and 7: 0 + 1 + 1, 0 + 1 + 1 and 1 + 0 + 1, each 2: write 0, carry 1.

The carry out is 1, so the sum is 100010011 = 256 + 16 + 2 + 1 = 275, and 154 + 121 = 275. The 8 bits alone, 00010011, name 19 = 275 − 256.

Exercise .

Prove that the carry out of x + y is 1 exactly when the n bits written in the columns name a number smaller than x.

▸ Show solution

If the carry out is 1, the n bits name r = x + y − 2ⁿ (Theorem 4). Since y ≤ 2ⁿ − 1, r ≤ x + 2ⁿ − 1 − 2ⁿ = x − 1 < x, and in the same way r < y.

If the carry out is 0, the n bits name r = x + y, and r ≥ x, r ≥ y. So the carry out is 1 exactly when the n-bit result is smaller than x: a program that sees only the n bits can still tell whether the carry was lost.

Exercise .

How many bits does the sum of three 8-bit unsigned integers need in the worst case? What about four, and five?

▸ Show solution

Three bytes add up to at most 3 × 255 = 765, and 765 < 1,024 = 2¹⁰, so 10 bits always suffice. 9 bits do not: they hold at most 2⁹ − 1 = 511 (Proposition 1), and 255 + 255 + 255 = 765 is more.

In general, k numbers of n bits add up to at most k × (2ⁿ − 1). For four bytes this is 1,020 < 1,024, still 10 bits; five bytes can reach 1,275, which needs 11.

Summary

  1. An n-bit unsigned integer is a pattern of n bits read as a binary numeral. Its values are exactly 0 to 2ⁿ − 1, each with one pattern; none is negative.
  2. Of two patterns of the same width, the one with the 1 in the leftmost position where they differ is larger; the number of 1s does not matter.
  3. Widening writes zeros on the left (zero extension). Narrowing to m bits keeps the remainder of x ÷ 2ᵐ, so it changes x unless x < 2ᵐ.
  4. Two n-bit unsigned integers are added in columns with carries. The sum always fits in n + 1 bits; it fits in n bits exactly when the carry out is 0, and otherwise the n bits name the sum minus 2ⁿ.
  5. Subtracting a larger number from a smaller one has no unsigned result: the borrow out signals it. Negative numbers need another reading of the bits.

Sources

  1. 1.
    Jean-Claude Franchitti and others, Introduction to Computer Science (web PDF of April 20, 2026, OpenStax, Rice University, 2024).
    Chapter 5, “Hardware Realizations of Algorithms: Computer Systems Design”, section 5.3, “Machine-Level Information Representation” (“Unsigned Integer Numbers Representation”), p. 206 (the whole topic: pp. 205–207).
    “An unsigned integer is a non-negative integer that starts from 0. If you see a number in binary and you are told that this number represents an unsigned number, you can get its decimal equivalent in the same way as base-10 integers but using base-2 instead.”
    Used for: an unsigned integer is a whole number that is never negative and starts from 0; its value is read as a binary numeral, as a decimal numeral is read with 10.
  2. 2.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    “Unsigned integers are ordinary binary values ranging from 0 to the maximum positive number that can be encoded in the selected operand size.”
    Used for: Intel’s manuals describe unsigned integers as ordinary binary values from 0 up to the largest number the width can hold.
  3. 3.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    Section “4.2.1.1, “Unsigned Integers” (p. 4-4, the end of a sentence that begins on p. 4-3)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
    “to 2³² – 1 for an unsigned doubleword integer, and from 0 to 2⁶⁴ – 1 for an unsigned quadword integer. Unsigned integers are sometimes referred to as ordinals.”
    Used for: Intel’s ranges of unsigned integers of 32 and 64 bits, 0 to 2³² − 1 in a doubleword and 0 to 2⁶⁴ − 1 in a quadword; unsigned integers are also called ordinals.
  4. 4.
    Jean-Claude Franchitti and others, Introduction to Computer Science (web PDF of April 20, 2026, OpenStax, Rice University, 2024).
    Chapter 5, “Hardware Realizations of Algorithms: Computer Systems Design”, section 5.3, “Machine-Level Information Representation” (“Unsigned Integer Numbers Representation”), p. 206 (the whole topic: pp. 205–207).
    “In general n bits can present 2ⁿ values, which is the range from 0 to 2ⁿ – 1. As you can see, there are no negative numbers. To be able to present negative numbers, we need to use signed numbers.”
    Used for: n bits present 2ⁿ values, from 0 to 2ⁿ − 1, none negative; to present negative numbers, signed numbers are needed.
  5. 5.
    ISO/IEC JTC 1/SC 22/WG 14, “N3220: working draft of ISO/IEC 9899:2024 (C23), the C programming language standard. A free draft that the C committee lists as similar to the published standard, not the ISO text itself”, open-std.org, the site of the ISO C standards committee (22 February 2024).
    Section “6.2.5, “Types”, paragraph 11 (p. 39)”. open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf · open at the quoted passage.
    “The range of representable values for the unsigned type is 0 to 2ᴺ −1 (inclusive).”
    Used for: the C standard gives the range of an unsigned type of width N as 0 to 2ᴺ − 1.
  6. 6.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    Section “4.2.1.1, “Unsigned Integers” (p. 4-3)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
    “Unsigned integers are unsigned binary numbers contained in a byte, word, doubleword, and quadword. Their values range from 0 to 255 for an unsigned byte integer, from 0 to 65,535 for an unsigned word integer”
    Used for: Intel’s unsigned integers come in four widths, byte, word, doubleword and quadword; the ranges of 8 and 16 bits: 0 to 255 in a byte and 0 to 65,535 in a word.
  7. 7.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    Section “4.1, “Fundamental Data Types” (p. 4-1)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
    “A byte is eight bits, a word is 2 bytes (16 bits), a doubleword is 4 bytes (32 bits), a quadword is 8 bytes (64 bits), and a double quadword is 16 bytes (128 bits).”
    Used for: Intel’s names for the widths: byte (8 bits), word (16), doubleword (32) and quadword (64).
  8. 8.
    James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 5: Conversions and Contexts”, Oracle (2025).
    Section “5.1.2, “Widening Primitive Conversion””. docs.oracle.com/javase/specs/jls/se25/html/jls-5.html · open at the quoted passage.
    “A widening conversion of a char to an integral type T zero-extends the representation of the char value to fill the wider format.”
    Used for: writing zeros into the new positions when a number is widened is called zero extension; Java’s widening conversion of its char type zero-extends the representation.
  9. 9.
    James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).
    Section “4.2, “Primitive Types and Values””. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
    “and char, whose values are 16-bit unsigned integers representing UTF-16 code units”
    Used for: Java’s char type is a 16-bit unsigned type (the sentence begins “The integral types are byte, short, int, and long, … and char”).
  10. 10.
    ISO/IEC JTC 1/SC 22/WG 14, “N3220: working draft of ISO/IEC 9899:2024 (C23), the C programming language standard. A free draft that the C committee lists as similar to the published standard, not the ISO text itself”, open-std.org, the site of the ISO C standards committee (22 February 2024).
    Section “6.3.1.3, “Signed and unsigned integers”, paragraph 2 (p. 47)”. open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf · open at the quoted passage.
    “Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.”
    Used for: the C standard’s rule for converting to an unsigned type a value it cannot hold: add or subtract one more than the type’s largest value until the value is in range.
  11. 11.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.3, “Algorithms for Integer Operations”: “Addition Algorithm”), p. 264 (the whole topic: pp. 264–265).
    “At the last stage, add aₙ₋₁, bₙ₋₁, and cₙ₋₂ to obtain cₙ₋₁ ⋅ 2 + sₙ₋₁. The leading bit of the sum is sₙ = cₙ₋₁.”
    Used for: two n-bit numbers are added in n columns, and the carry out of the last column becomes the leading bit of the sum.
  12. 12.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    Section “3.4.3.1, “Status Flags” (p. 3-16)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
    “Carry flag — Set if an arithmetic operation generates a carry or a borrow out of the most-significant bit of the result; cleared otherwise. This flag indicates an overflow condition for unsigned-integer arithmetic.”
    Used for: Intel’s carry flag records the carry out of the most significant bit, and also a borrow out of it, and signals an overflow condition for unsigned arithmetic.
  13. 13.
    Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).
    Section “9.3, “Saturation and Wraparound Modes” (p. 9-4)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
    “Unsigned saturation arithmetic — With unsigned saturation arithmetic, out-of-range results are limited to the representable range of unsigned integers for the integer size. So, positive overflow when operating on unsigned byte integers results in FFH being returned”
    Used for: some Intel instructions use unsigned saturation arithmetic, in which a byte result that is too large comes out as 0xFF (Intel writes FFH), the largest value.
  14. 14.
    “<sys/types.h>: data types”, The Open Group Base Specifications Issue 8 (IEEE Std 1003.1-2024, POSIX) (2024).
    “size_t Used for sizes of objects.”
    Used for: the POSIX standard has a type size_t for the sizes of objects.
  15. 15.
    “<sys/types.h>: data types”, The Open Group Base Specifications Issue 8 (IEEE Std 1003.1-2024, POSIX) (2024).
    “size_t shall be an unsigned integer type.”
    Used for: POSIX requires size_t to be an unsigned integer type.