官术网_书友最值得收藏!

Bit #11 - overflow flag

The overflow flag (OF) is sometimes perceived as two's complement form of the carry flag, which is not really the case. OF is set when the result of the operation is either too small or too big a number to fit into the destination operand. For example, consider the addition of two 8-bit positive values, 0x74 and 0x7f. The resulting value of such an addition is 0xf3, which is still 8-bit, which is fine for unsigned numbers, but since we added two values that we considered to be signed, there has to be the sign bit and there are no more bits to store the 9-bit signed result. The same would happen if we try to add two negative 8-bit values, 0x82 and 0x81. The meaning of the addition of two negative numbers is in the fact subtraction of a positive number from a negative number, which should result in an even smaller number. Thus, 0x82 + 0x81 would result in 0x103, where the ninth bit, 1, is the sign bit, but it cannot be stored in an 8-bit operand. The same applies to larger operands (16, 32, and 64-bit).

主站蜘蛛池模板: 谢通门县| 昌黎县| 河曲县| 新巴尔虎右旗| 丹棱县| 鄂尔多斯市| 桦甸市| 连城县| 筠连县| 花莲县| 红原县| 衢州市| 土默特右旗| 铅山县| 中方县| 溧水县| 唐海县| 勐海县| 景洪市| 九龙城区| 洛宁县| 赫章县| 彝良县| 苏州市| 武平县| 汶川县| 建水县| 石首市| 潜江市| 营山县| 沙雅县| 洪雅县| 泸州市| 浪卡子县| 南陵县| 无为县| 建昌县| 冕宁县| 大余县| 磐安县| 长岛县|