summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/grobot.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/grobot.h b/include/grobot.h
index 52a7039..60796a9 100644
--- a/include/grobot.h
+++ b/include/grobot.h
@@ -66,7 +66,10 @@ struct _GRobotClass {
/* some convenient macros */
#define G_ROBOT_POSITION_X(robot) ((robot)->x)
#define G_ROBOT_POSITION_Y(robot) ((robot)->y)
-#define sign(x) (x/abs(x))
+
+/* this is a little weird, but 0 case doesn't actually matter
+ given how the code in grobot.c uses this macro... */
+#define sign(x) (x ? x/abs(x) : 0)
/* normal GObject stuff */
GType g_robot_get_type(void) G_GNUC_CONST;