assembly - SHR and SAR Commands -
i make sure understanding concept 100% , if not clarification.
in asm program, if perform shr 00110000b
end 00011000b
. however, if perform shr
on 11111111b
end incorrect answer , should use sar
instead? because number signed?
if perform
shr
00110000b end 00011000b
if shifted 1 bit right, yes. can specify shift amount, it's not fixed @ 1.
however, if perform
shr
on 11111111b end incorrect answer
if did logical shift of 11111111b 1 bit right you'd 01111111b. whether consider incorrect or not depends entirely on you're trying achieve. if wanted preserve sign should've used sar
.
Comments
Post a Comment