半字节

来自Local Chinese Wikipedia
跳转到导航 跳转到搜索
File:Octets in CP866 ordered by nibbles.png
一个八位元 code page 866英语code page 866字形表,以半字节排序

计算机科学里的半字节nibble[1]是表示四个位元资讯单位,其资料量是字节(八位元)的一半[1][2][3]

半字节可以表示16(24)个可能的值,半字节的数值可以用十六进制的一位数字表示[4]。一个字节是由二个半字节组成,因此会用二个十六进制数字表示。

四位元电脑在储存和运算时会使用半字节大小的资料。这类电脑用在早期的微处理器电子计算器pocket computer英语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

高半字节是01102616),低半字节是00012116),整个数字是high-nibble × 1610 + low-nibble6 × 16 + 1 = 9710)。

相关条目[编辑]

参考资料[编辑]

  1. 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. [...] 
  2. Hall, Douglas V. Microprocessors and Digital Systems. McGraw-Hill. 1980. ISBN 0-07-025571-7. 
  3. Warren Jr., Henry S. Hacker's Delight 2. Addison WesleyPearson Education, Inc. 2013 [2002]. ISBN 978-0-321-84268-8. 0-321-84268-5. 
  4. Heller, Steve. Introduction to C++. Morgan Kaufmann. 1997: 27. ISBN 978-0-12-339099-8. Each hex digit (0–f) represents exactly 4 bits. 
  5. Baccala, Brent. Binary arithmetic. Connected: An Internet Encyclopedia 3rd. April 1997 [2015-07-20]. (原始内容存档于2016-08-06). 

外部链接[编辑]