On Mon, Sep 6, 2010 at 9:43 AM, Kurosu <[email protected]> wrote:
>> BTW, Cortex-A8 also lacks integer division which needs to be done in
>> software, that's why you see __aeabi_uidivmod and the likes...
>
> Sounds like *unsigned* integer division, but still I didn't know about it.
> Worse would be that for some reasons, this replaces a bitshift...
I appears that almost half of the division were coming from
MeterDistance used by mines calculating distance to characters. I
tried to change division to multiplication and it cuts divisions to
about half and mines are refreshed also faster.
There are quite a few places where something is divided by
PIXEL_PER_METER. I wonder what happened if it was changed to something
like 32?
--
Mikko Vartiainen
Index: src/object/physical_obj.cpp
===================================================================
--- src/object/physical_obj.cpp (revision 8358)
+++ src/object/physical_obj.cpp (working copy)
@@ -51,7 +51,7 @@
Double MeterDistance(const Point2i &p1, const Point2i &p2)
{
- return p1.Distance(p2) / PIXEL_PER_METER;
+ return p1.Distance(p2) * METER_PER_PIXEL;
}
PhysicalObj::PhysicalObj (const std::string &name, const std::string &xml_config) :
Index: src/object/physical_obj.h
===================================================================
--- src/object/physical_obj.h (revision 8358)
+++ src/object/physical_obj.h (working copy)
@@ -43,6 +43,7 @@
class Action;
#define PIXEL_PER_METER 40
+#define METER_PER_PIXEL 0.025
Double MeterDistance(const Point2i &p1, const Point2i &p2);
_______________________________________________
Wormux-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-dev