Commit Graph

7 Commits

Author SHA1 Message Date
Markus Hitter 81f85b018d Move utility functions from dda.c to dda_math.c.
Simple cleanup, no functional change.
2012-08-04 22:07:24 +02:00
Markus Hitter e0959f7ce2 Make muldiv() inline instead of a #define, too. 2012-08-04 22:07:15 +02:00
Markus Hitter d49c0745d5 dda_maths.h: make um_to_steps_{xyze}() inline functions.
Size and speed is the same as with #defines, but now there is
type checking.
2012-08-04 22:06:59 +02:00
Markus Hitter 44be918d2a Introduce muldivQR().
This is a version of muldiv() with qn and rn precalculated,
so it can be avoided to re-calclulate it on every instance.

Yet another 116 bytes, unfortunately.
2012-08-04 22:01:30 +02:00
Markus Hitter 0068ed1e26 Use the new muldiv() to replace um_to_steps..().
This gets rid of overflows at micrometer to step conversion as
much as possible within 31 bits. It also opens the door to get
STEPS_PER_M configurable at runtime.

This also costs 290 bytes, unfortunately.
2012-08-04 22:01:16 +02:00
Markus Hitter a2f1412aec Make muldiv() multiplicand signed.
As Andrey correctly pointed out, we need this signed. See:
http://forums.reprap.org/read.php?147,89710,130225#msg-130225
and following posts.
2012-07-16 20:13:43 +02:00
Markus Hitter 7efb895ee3 Introduce an integer multiply-divide algorithm.
We have multiplies followed by divides all over the place and
most of them are difficult to handle regarding overflows. This
new algorithm handles this fine in all cases, as long as all
three operators and the overall result fits into 32 bits.
2012-07-16 20:13:29 +02:00