assembly - Practical uses for rotate carry left/right -
what practical uses rotate carry left , rotate carry right instructions?
in assembly class , cannot come illustration useful.
if want shift bits out of 1 operand, , another:
shl eax, 1 ; move sign bit of eax ... rcl edx ; lsb of edx
if wanted reverse bits in eax:
mov ecx, 32 loop: shr eax, 1 rcl edx dec ecx jne loop ; edx == eax bits reversed here
the real point these rotate instructions capture "bits" of info other operands, , allow combine existing data. want machine provide rich set of info manipulation primitives can arbitrary info shuffling.
having said that, in searching through application of mine of 30,000 assembly source lines, see 3 or 4 uses. then, have no uses of other instructions in intel instruction set. used doesn't mean useless.
can live without these instructions? sure, cpu turing capable.
assembly programming-languages
No comments:
Post a Comment