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

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).

主站蜘蛛池模板: 大关县| 岱山县| 寻乌县| 南澳县| 齐河县| 通河县| 南投市| 湖南省| 霍林郭勒市| 库车县| 鹤壁市| 延庆县| 利津县| 玛曲县| 石台县| 开化县| 阳新县| 武隆县| 西乌| 昆山市| 宜州市| 兰州市| 海晏县| 珲春市| 武汉市| 嵊泗县| 昂仁县| 青河县| 定安县| 巴东县| 浠水县| 尤溪县| 周宁县| 云林县| 全州县| 都昌县| 玉树县| 乐至县| 开鲁县| 开远市| 靖安县|