assembly - Implementing rotate left using AND, NOT, and ADD operations -
i'm implementing 16-bit bit shifter rotate bits left r. have access and
, not
, add
operations. there 3 condition codes: negative, zero , positive, set when use of these operations.
this approach:
and
number1000 0000 0000 0000
set condition codes positive if significant bit1
.add
number itself. shifts bits left one.- if msb
1
,add
1
result. - loop through steps (1)-(3) r times.
are there other efficient ways can this?
since homework, i'll think it.
2 * 2 = 4 4 * 2 = 8 8 * 2 = 16 0010 * 0010 = 00100 0100 * 0010 = 01000 1000 * 0010 = 10000
a left shift [some unknown] operation. [some unknown] operation can implemented using and, not , add doing...
Comments
Post a Comment