diff options
Diffstat (limited to 'softint/mul.c')
-rw-r--r-- | softint/mul.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/softint/mul.c b/softint/mul.c new file mode 100644 index 0000000..45cff00 --- /dev/null +++ b/softint/mul.c @@ -0,0 +1,22 @@ + +#include <stdint.h> + +long softint_mul( long x, long y ) +{ + + int i; + long result = 0; + + for (i = 0; i < sizeof(long); i++) { + if ((x & 0x1) == 1) + result = result + y; + + x = x >> 1; + y = y << 1; + } + + return result; + +} + + |