mirror of
https://github.com/Michaelangel007/apple2_russian_peasant_multiplication.git
synced 2024-12-21 14:30:06 +00:00
Fix algorithm step 2 description C code
This commit is contained in:
parent
012c1c71ac
commit
ae25ca294b
@ -35,7 +35,7 @@ An alternative algorithm to implement multiplication using only:
|
||||
# Algorithm
|
||||
|
||||
1. Initialize Sum <- zero. In C nomenclature: `Sum = 0;`
|
||||
2. If B is odd then add A to Sum. In C nomenclature: `Sum += A;`
|
||||
2. If B is odd then add A to Sum. In C nomenclature: `if( B & 1 ) Sum += A;`
|
||||
3. Multiply A by 2 -- that is, Shift A **left** by one. In C nomenclature: `A <<= 1;`
|
||||
4. Divide B by 2 -- that is, Shift B **right** by one. In C nomenclature: ` B >>= 1;`
|
||||
5. If B is zero then STOP. `while( b ) { ... }`
|
||||
|
Loading…
Reference in New Issue
Block a user