! multiplication: this = this * ss2 it can return a carry */
| 792 | it can return a carry |
| 793 | */ |
| 794 | uint MulInt(uint ss2) |
| 795 | { |
| 796 | uint r1, r2, x1; |
| 797 | uint c = 0; |
| 798 | |
| 799 | UInt<value_size> u(*this); |
| 800 | SetZero(); |
| 801 | |
| 802 | if( ss2 == 0 ) |
| 803 | { |
| 804 | TTMATH_LOGC("UInt::MulInt(uint)", 0) |
| 805 | return 0; |
| 806 | } |
| 807 | |
| 808 | for(x1=0 ; x1<value_size-1 ; ++x1) |
| 809 | { |
| 810 | MulTwoWords(u.table[x1], ss2, &r2, &r1); |
| 811 | c += AddTwoInts(r2,r1,x1); |
| 812 | } |
| 813 | |
| 814 | // x1 = value_size-1 (last word) |
| 815 | MulTwoWords(u.table[x1], ss2, &r2, &r1); |
| 816 | c += (r2!=0) ? 1 : 0; |
| 817 | c += AddInt(r1, x1); |
| 818 | |
| 819 | TTMATH_LOGC("UInt::MulInt(uint)", c) |
| 820 | |
| 821 | return (c==0)? 0 : 1; |
| 822 | } |
| 823 | |
| 824 | |
| 825 | /*! |
no test coverage detected