zoukankan      html  css  js  c++  java
  • 【译】x86程序员手册04

    2.2 Data Types 数据类型

    Bytes, words, and doublewords are the fundamental data types (refer to Figure 2-2 ). A byte is eight contiguous bits starting at any logical address. The bits are numbered 0 through 7; bit zero is the least significant bit.

    字节,字和双字是基本的数据类型(见图2-2)。一个字节在任何逻辑地址中都是连续的8位。位表示从0到7;位0是最小的有意义的位。

     

    A word is two contiguous bytes starting at any byte address. A word thus contains 16 bits. The bits of a word are numbered from 0 through 15; bit 0 is the least significant bit. The byte containing bit 0 of the word is called the low byte; the byte containing bit 15 is called the high byte.

    一个字是两个连续的字节,可以在任何位地址开始。一个字由16位构成。位由0到15来表示;位0是最小的有意义的位。从0开始的字节被称作低字节;从位15开始的字节被称作高字节。

    Each byte within a word has its own address, and the smaller of the addresses is the address of the word. The byte at this lower address contains the eight least significant bits of the word, while the byte at the higher address contains the eight most significant bits.

    字中的每个字节都有自己的地址,低地址部分的字节包含字中最小意义的8位,而高字节则包含高位部分的8位。

    A doubleword is two contiguous words starting at any byte address. A doubleword thus contains 32 bits. The bits of a doubleword are numbered from 0 through 31; bit 0 is the least significant bit. The word containing bit 0 of the doubleword is called the low word; the word containing bit 31 is called the high word.

    双字是两个任意字节地址开始的连续的字组成。因此双字包含32位。双字的位命名从0到31;位0是最小位。双字中包含位0的字被称作低字;包含位31的则被称作高字。

    Each byte within a doubleword has its own address, and the smallest of the addresses is the address of the doubleword. The byte at this lowest address contains the eight least significant bits of the doubleword, while the byte at the highest address contains the eight most significant bits. Figure 2-3 illustrates the arrangement of bytes within words anddoublewords.

    双字中的每个字节都有自己的地址,最小的址是双字的地址。最小地址的字节是包含双字最小位的8位,而在最高地址的字节是包含最高位的8位。图2-3解释了双字中的字节分配。

     

    Note that words need not be aligned at even-numbered addresses and doublewords need not be aligned at addresses evenly divisible by four. This allows maximum flexibility in data structures (e.g., records containing mixed byte, word, and doubleword items) and efficiency in memory utilization. When used in a configuration with a 32-bit bus, actual transfers of data between processor and memory take place in units of doublewords beginning at addresses evenly divisible by four; however, the processor converts requests for misaligned words or doublewords into the appropriate sequences of requests acceptable to the memory interface. Such misaligned data transfers reduce performance by requiring extra memory cycles. For maximum performance, data structures (including stacks) should be designed in such a way that, whenever possible, word operands are aligned at even addresses and doubleword operands are aligned at addresses evenly divisible by four. Due to instruction prefetching and queuing within the CPU, there is no requirement for instructions to be aligned on word or doubleword boundaries. (However, a slight increase in speed results if the target addresses of control transfers are evenly divisible by four.) Although bytes, words, and doublewords are the fundamental types of operands, the processor also supports additional interpretations of these operands. Depending on the instruction referring to the operand, the following additional data types are recognized:

    注意:字不需要在偶数地址对齐,同样双字也不需要被4整除的地址对齐。这样就允许在数据结构上具有最大的伸缩性(比如:一个记录由字节、字和双字条目混合组成),并且在内存利用上最有效。在配置了32位总线上使用时,处理器和内存之间的实际的数据传输时总是以被4整除的偶数地址开始的双字为单位。处理器会将不对齐的字或双字的需求转换为内存接口可以接受的连续的需求。当然这些不对齐的数据村办会引起额外的内存周期。为了最高效,数据结构(包括任务)应当被设计为如下方式,无论如何,字操作对齐到偶数地址,双字操作应当对齐到被4整除的地址。由于对CPU的执行和查询的指原因,对于指令没有必要进行字或双字边界对齐。(然而,如果目标地址的控制转换也能被4整除,会带来些许速度上的增加)尽管字节、字和双字是操作的基本类型,处理器也支持对额外的操作的解释。这依赖于相关的操作指令,下面的额外的数据类型也可以被识别:

    Integer: 整数

    A signed binary numeric value contained in a 32-bit doubleword, 16-bit word, or 8-bit byte. All operations assume a 2's complement representation. The sign bit is located in bit 7 in a byte, bit 15 in a word, and bit 31 in a doubleword. The sign bit has the value zero for positive integers and one for negative. Since the high-order bit is used for a sign, the range of an 8-bit integer is -128 through +127; 16-bit integers may range from -32,768 through +32,767; 32-bit integers may range from -2^(31) through +2^(31) -1. The value zero has a positive sign.

    带符号的二进制数值,可以包含32位双字,16位的字或者8位的字节。所有的操作都假设一个2的次方的表示。符号位在字节中是位7,在字中是位15,在双字中是位31。符号位为0表示正数,1表示负数。因为最高位被用做符号位,所在8位整数范围是-128到+127;16位整数可用范围为-32768到+32767;32位整数范围为-2^(31)到+2^(31)-1。0值有符号。

     

    Ordinal: 普通

    An unsigned binary numeric value contained in a 32-bit doubleword, 16-bit word, or 8-bit byte. All bits are considered in determining magnitude of the number. The value range of an 8-bit ordinal number is 0-255; 16 bits can represent values from 0 through 65,535; 32 bits can represent values from 0 through 2^(32) -1.

    一个普通的二进制数值包含32位双字、16位字或8位字节。所有位都用于表示数字。其值范围为8位的是0-255;16位的为0-65535;32位为0到2^(32)-1。

    Near Pointer: 近指针

    A 32-bit logical address. A near pointer is an offset within a segment. Near pointers are used in either a flat or a segmented model of memory organization.

    一个32位的逻辑地址。一个近指针是一个段内偏移量。近指针可在扁平地址或分段模式的内存组织中使用。

    Far Pointer: 远指针

    A 48-bit logical address of two components: a 16-bit segment selector component and a 32-bit offset component. Far pointers are used by applications programmers only when systems designers choose a segmented memory organization.

    48位的逻辑地址由两部分构成:一个16位的段选择子以及一个32位的偏移量。远指针仅被用来系统设计者选择分段内存组织的应用程序中。

    String: 字符

    A contiguous sequence of bytes, words, or doublewords. A string may contain from zero bytes to 2^(32) -1 bytes (4 gigabytes).

    是连续的字节、字或双字。一个字符串可以包含从0到2^(32)-1个字(4G)。

    Bit field: 位段

    A contiguous sequence of bits. A bit field may begin at any bit position of any byte and may contain up to 32 bits.

    一个连续的位。一个位段可以开始于一个字节的任何位,而且可以最多包含32位。

    Bit string: 位字符

    A contiguous sequence of bits. A bit string may begin at any bit position of any byte and may contain up to 2^(32) -1 bits.

    是连续的位。位字符串可以开始于一个字节的任何位置,最大可以包含2^(32)-1个位。

    BCD: BCD编码

    A byte (unpacked) representation of a decimal digit in the range 0 through 9. Unpacked decimal numbers are stored as unsigned byte quantities. One digit is stored in each byte. The magnitude of the number is determined from the low-order half-byte; hexadecimal values 0-9 are valid and are interpreted as decimal numbers. The high-order half-byte must be zero for multiplication and division; it may contain any value for addition and subtraction.

    一个字节(未压缩)用来代表一个从0到9的数字。未压缩的数字被做为无符字节存储。每个字节存储一个数字。存储的数字的量取决于低端半个字节;十六进制的0到9的字符是有效的,并且被解释成数字。高端的半个字节必须是0来代表乘或除;代表加和减时可以包含任何值。

    Packed BCD:

    A byte (packed) representation of two decimal digits, each in the range 0 through 9. One digit is stored in each half-byte. The digit in the high-order half-byte is the most significant. Values 0-9 are valid in each half-byte. The range of a packed decimal byte is 0-99.

    一个字节(压缩)代表两位0到9的数字。每个数字被存储在半个字节中。高位半个字节中的数字是最重要的。每个半字节中的数值只能是0-9。被压缩的数字字节范围是0-99。

  • 相关阅读:
    软件体系结构:二维分层、模块化和开放平台
    Unity手游之路<七>角色控制器
    Unity手游之路<四>3d旋转-四元数,欧拉角和变幻矩阵
    Unity手游之路<三> 基于Unity+Java的聊天室源码
    Unity手游之路<二>Java版服务端使用protostuff简化protobuf开发
    Unity手游之路<一>C#版本Protobuf
    Unity手游之路<八>自动寻路Navmesh之入门
    Unity手游之路<九>自动寻路Navmesh之高级主题
    Unity手游之路<十>自动寻路Navmesh之跳跃,攀爬,斜坡
    raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found 解决办法
  • 原文地址:https://www.cnblogs.com/mqmelon/p/6692084.html
Copyright © 2011-2022 走看看