EtchedPixels / Fuzix-Compiler-Kit

Fuzix C Compiler Project
Other
49 stars 13 forks source link

support6800/__mulf.c does not do multiplication correctly. #132

Closed zu2 closed 3 weeks ago

zu2 commented 3 weeks ago

All architectures have the same typo in __mulf.c.

--- ../Fuzix-Compiler-Kit/support6800/__mulf.c  2024-10-13 22:57:57
+++ support6800/__mulf.c    2024-10-26 10:08:03
@@ -38,7 +38,7 @@
    a2 = MANT(a2);

    /* the multiply is done as one 16x16 multiply and two 16x8 multiples */
-   result = (a1 >> 8) * (a1 >> 8);
+   result = (a1 >> 8) * (a2 >> 8);
    result += ((a1 & 0xFFUL) * (a2 >> 8)) >> 8;
    result += ((a2 & 0xFFUL) * (a1 >> 8)) >> 8;
EtchedPixels commented 3 weeks ago

Thanks. FP is a mostly untested at this point so there may well be more like that.