The name of 16 and 32 bits

18,267

Solution 1

A byte is the smallest unit of data that a computer can work with. The C language defines char to be one "byte" and has CHAR_BIT bits. On most systems this is 8 bits.

A word on the other hand, is usually the size of values typically handled by the CPU. Most of the time, this is the size of the general-purpose registers. The problem with this definition, is it doesn't age well.

For example, the MS Windows WORD datatype was defined back in the early days, when 16-bit CPUs were the norm. When 32-bit CPUs came around, the definition stayed, and a 32-bit integer became a DWORD. And now we have 64-bit QWORDs.

Far from "universal", but here are several different takes on the matter:

Windows:

  • BYTE - 8 bits, unsigned
  • WORD - 16 bits, unsigned
  • DWORD - 32 bits, unsigned
  • QWORD - 64 bits, unsigned

GDB:

  • Byte
  • Halfword (two bytes).
  • Word (four bytes).
  • Giant words (eight bytes).

<stdint.h>:

  • uint8_t - 8 bits, unsigned
  • uint16_t - 16 bits, unsigned
  • uint32_t - 32 bits, unsigned
  • uint64_t - 64 bits, unsigned
  • uintptr_t - pointer-sized integer, unsigned

(Signed types exist as well.)

If you're trying to write portable code that relies upon the size of a particular data type (e.g. you're implementing a network protocol), always use <stdint.h>.

Solution 2

Dr. Werner Buchholz coined the word byte to mean, "a unit of digital information to describe an ordered group of bits, as the smallest amount of data that a computer could process." Therefore, the word's actual meaning is dependent on the machine in question's architecture. The number of bits in a byte is therefore arbitrary, and could be 8, 16, or even 32.

For a thorough dissertation on the subject, refer to Wikipedia.

Solution 3

The correct name for a group of exactly 8 bits is really an octet. A byte may have more than or fewer than 8 bits (although this is relatively rare).

Beyond this there are no rigorously well-defined terms for 16 bits, 32 bits, etc, as far as I know.

Solution 4

There's no universal name for 16-bit or 32-bit units of measurement.

The term 'word' is used to describe the number of bits processed at a time by a program or operating system. So, in a 16-bit CPU, the word length is 16 bits. In a 32-bit CPU, the word length is 32 bits. I also believe the term is a little flexible, so if I write a program that does all its processing in chunks of say, 10 bits, I could refer to those 10-bit chunks as 'words'.

And just to be clear; 'int' is not a unit of measurement for computer memory. It really is just the data type used to store integer numbers (i.e. numbers with a decimal component of zero). So if you find a way to implement integers using only 2 bits (or whatever) in your programming language, that would still be an int.

Share:
18,267
Ecir Hana
Author by

Ecir Hana

Updated on June 04, 2022

Comments

  • Ecir Hana
    Ecir Hana almost 2 years

    8 bits is called "byte". How is 16 bits called? "Short"? "Word"?

    And what about 32 bits? I know "int" is CPU-dependent, I'm interested in universally applicable names.