为什么可以存储的最小值是Byte(8bit)&amp ;?不是Bit(1bit)? [英] Why is the smallest value that can be stored is a Byte(8bit) & not a Bit(1bit)?

查看:182
本文介绍了为什么可以存储的最小值是Byte(8bit)&amp ;?不是Bit(1bit)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么是可以存储Byte(8bit)的最小值?内存中没有Bit(1bit)吗? 甚至布尔也存储为字节.我们会不会像CPU上的寄存器那样将最小的数字增加到32或64位?

Why is the smallest value that can be stored a Byte(8bit) & not a Bit(1bit) in memory? Even booleans are stored as Bytes. Will we ever bump the smallest number to 32 or 64bits like register's on the CPU?

推荐答案

处理器访问的基础方法仅限于最小可用寄存器的大小.在大多数体系结构上,该大小为8位.您可以使用其中的较小部分.例如,C在结构中具有位字段功能,该功能允许组合仅需要特定位长的字段.访问仍然需要读取整个字节.

The underlying methods of processor access are limited to the size of the smallest usable register. On most architectures, that size is 8 bits. You can use smaller portions of these; for instance, C has the bitfield feature in structs that will allow combining fields that only need to be certain bit lengths. Access will still require that the whole byte be read.

一些较早的异国建筑实际上确实具有不同的字长".在这些机器中,常见的大小可能是10位.

Some older exotic architectures actually did have different a "word size." In these machines, 10 bits might be the common size.

最后,处理器几乎总是向后兼容.例如,英特尔从386起一直保持完整的指令兼容性.如果您使用为386编译的程序,它仍将在i7处理器上运行.更改字长会破坏兼容性.因此,尽管有可能 ,但没有制造商会这样做.

Lastly, processors are almost always backwards compatible. Intel, for instance, has maintained complete instruction compatibility from the 386 on up. If you take a program compiled for the 386, it will still run on an i7 processor. Changing the word size would break compatibility. So while it is possible, no manufacturer will ever do it.

这篇关于为什么可以存储的最小值是Byte(8bit)&amp ;?不是Bit(1bit)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆