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

Counter

ECX register - also known as counter register. This register is used in loops as a loop iteration counter. It is first loaded with a number of iterations, and then decremented each time the loop instruction is executed until the value stored in ECX becomes zero, which instructs the processor to break out of the loop. We can compare this to the do{...}while() clause in C:

int ecx = 10; 
do
{
// do your stuff
ecx--;
}while(ecx > 0);

Another common usage of this register, actually the usage of its least significant part, CL, is in bitwise shift operations, where it contains the number of bits in which the source operand should be shifted. Consider the following code, for example:

mov eax, 0x12345
mov cl, 5
shl eax, cl

This would result in the register EAX being shifted 5 bits to the left (having the value of 0x2468a0 as a result).

主站蜘蛛池模板: 普兰店市| 滨海县| 阆中市| 江孜县| 门源| 卫辉市| 湾仔区| 邻水| 大石桥市| 汤阴县| 营口市| 湖州市| 封开县| 夹江县| 策勒县| 武清区| 蛟河市| 招远市| 方山县| 乐安县| 新野县| 广平县| 扶风县| 商洛市| 冷水江市| 达州市| 高密市| 九江县| 扎鲁特旗| 红河县| 莱芜市| 通榆县| 定州市| 集贤县| 伊吾县| 湘阴县| 通道| 大邑县| 镇江市| 县级市| 防城港市|