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:

  1. and number 1000 0000 0000 0000 set condition codes positive if significant bit 1.
  2. add number itself. shifts bits left one.
  3. if msb 1, add 1 result.
  4. 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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -