半字節
外观
此條目需要补充更多来源。 (2025年8月) |

计算机科学裡的半字節(nibble)[1]是表示四個位元的資訊單位,其資料量是字節(八位元)的一半[1][2][3]。
半字節可以表示16(24)個可能的值,半字節的數值可以用十六进制的一位數字表示[4]。一個字節是由二個半字節組成,因此會用二個十六進制數字表示。
四位元電腦在儲存和運算時會使用半字節大小的資料。這類電腦用在早期的微处理器、电子计算器和pocket computer上。目前也使用在一些单片机上。
半字節的數值
[编辑]半字節大小的數值可以用不同的進制表示:
二進制 | 十進制 | 十六進制 |
---|---|---|
0000 | 0 | 0 |
0001 | 1 | 1 |
0010 | 2 | 2 |
0011 | 3 | 3 |
0100 | 4 | 4 |
0101 | 5 | 5 |
0110 | 6 | 6 |
0111 | 7 | 7 |
1000 | 8 | 8 |
1001 | 9 | 9 |
1010 | 10 | A |
1011 | 11 | B |
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
低半字節和高半字節
[编辑]字節的低半字節和高半字節是字節較低的半字節,和較高的半字節。字節若用十六進制表示,會是二個十六進制的數字,高半字節是較高位數的十六進制數字,低半字節是較低位數的十六進制數字。字節若用二進制表示,高半字節和低半字節分別是較高四位數和較低四位數的二進制數字[5]。例如
- 97 = 9710 = (0110 0001)2 = 6116
高半字節是01102(616),低半字節是00012(116),整個數字是high-nibble × 1610 + low-nibble(6 × 16 + 1 = 9710)。
相關條目
[编辑]參考資料
[编辑]- ^ 1.0 1.1 Raphael, Howard A. (编). The Functions Of A Computer: Instruction Register And Decoder (PDF). MCS-40 User's Manual For Logic Designers. Santa Clara, California, USA: Intel Corporation. November 1974: viii [2020-03-03]. (原始内容存档 (PDF)于2020-03-03).
[...] The characteristic eight bit field is sometimes referred to as a byte, a four bit field can be referred to as a nibble. [...]
- ^ Hall, Douglas V. Microprocessors and Digital Systems. McGraw-Hill. 1980. ISBN 0-07-025571-7.
- ^ Warren Jr., Henry S. Hacker's Delight 2. Addison Wesley – Pearson Education, Inc. 2013 [2002]. ISBN 978-0-321-84268-8. 0-321-84268-5.
- ^ Heller, Steve. Introduction to C++. Morgan Kaufmann. 1997: 27. ISBN 978-0-12-339099-8.
Each hex digit (0–f) represents exactly 4 bits.
- ^ Baccala, Brent. Binary arithmetic. Connected: An Internet Encyclopedia 3rd. April 1997 [2015-07-20]. (原始内容存档于2016-08-06).
外部連結
[编辑]- Apple Assembly Line. May 1981.