If I start with integer 1
and repeatedly LSL
the value in the register, once the integer overflows, what is the intended behaviour?
mov r0,#1 /* 00000000000000000000000000000001 */
lsl r0,#1 /* 00000000000000000000000000000010 */
/* repeat 31 times */
lsl r0,#1 /* 10000000000000000000000000000000 */
On the next LSL, should the program:
From section A2.2.1 of the v6-M reference manual, "Integer arithmetic", subsection "Shift and rotate operations":
(LSL) moves each bit of a bitstring left by a specified number of bits. Zeros are shifted in at the right end of the bitstring. Bits that are shifted off the left end of the bitstring are discarded, except that the last such bit can be produced as a carry output.
Therefore it becomes 0 and the carry flag is set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.