wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of GNU CC. |
| 3 | * |
| 4 | * GNU CC is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published |
| 6 | * by the Free Software Foundation; either version 2, or (at your |
| 7 | * option) any later version. |
| 8 | * |
| 9 | * GNU CC is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public |
| 15 | * License along with GNU CC; see the file COPYING. If not, write |
| 16 | * to the Free Software Foundation, 59 Temple Place - Suite 330, |
| 17 | * Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #include <common.h> |
| 22 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 23 | #if !defined(CONFIG_SYS_NIOS_MULT_HW) && !defined(CONFIG_SYS_NIOS_MULT_MSTEP) |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 24 | |
| 25 | #include "math.h" |
| 26 | |
| 27 | USItype __mulsi3 (USItype a, USItype b) |
| 28 | { |
| 29 | USItype c = 0; |
| 30 | |
| 31 | while (a != 0) { |
| 32 | if (a & 1) |
| 33 | c += b; |
| 34 | a >>= 1; |
| 35 | b <<= 1; |
| 36 | } |
| 37 | |
| 38 | return c; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | UHItype __mulhi3 (UHItype a, UHItype b) |
| 43 | { |
| 44 | UHItype c = 0; |
| 45 | |
| 46 | while (a != 0) { |
| 47 | if (a & 1) |
| 48 | c += b; |
| 49 | a >>= 1; |
| 50 | b <<= 1; |
| 51 | } |
| 52 | |
| 53 | return c; |
| 54 | } |
| 55 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 56 | #endif /*!defined(CONFIG_SYS_NIOS_MULT_HW) && !defined(CONFIG_SYS_NIOS_MULT_MSTEP) */ |