Moved ABS() macro to globals.
authorFlorian Pose <fp@igh-essen.com>
Mon, 19 Apr 2010 21:52:46 +0200
changeset 1904 2fadf016d9be
parent 1903 5b526d0f5a5d
child 1905 5abe24872083
Moved ABS() macro to globals.
master/fsm_slave_config.c
master/globals.h
--- a/master/fsm_slave_config.c	Mon Apr 19 21:51:01 2010 +0200
+++ b/master/fsm_slave_config.c	Mon Apr 19 21:52:46 2010 +0200
@@ -416,8 +416,6 @@
 
 /*****************************************************************************/
 
-#define ABS(X) ((X) >= 0 ? (X) : -(X))
-
 /** Configure 32 bit time offset.
  */
 u64 ec_fsm_slave_config_dc_offset32(
@@ -445,7 +443,7 @@
                 slave->ring_position, system_time32, correction,
                 (u32) slave->master->app_time, time_diff);
 
-    if (ABS(time_diff) > EC_SYSTEM_TIME_TOLERANCE_NS) {
+    if (EC_ABS(time_diff) > EC_SYSTEM_TIME_TOLERANCE_NS) {
         new_offset = time_diff + old_offset32;
         if (slave->master->debug_level)
             EC_DBG("Slave %u: Setting time offset to %u (was %u)\n",
@@ -486,7 +484,7 @@
                 slave->master->app_time, time_diff);
 
 
-    if (ABS(time_diff) > EC_SYSTEM_TIME_TOLERANCE_NS) {
+    if (EC_ABS(time_diff) > EC_SYSTEM_TIME_TOLERANCE_NS) {
         new_offset = time_diff + old_offset;
         if (slave->master->debug_level)
             EC_DBG("Slave %u: Setting time offset to %llu (was %llu)\n",
--- a/master/globals.h	Mon Apr 19 21:51:01 2010 +0200
+++ b/master/globals.h	Mon Apr 19 21:52:46 2010 +0200
@@ -260,6 +260,12 @@
 
 /*****************************************************************************/
 
+/** Absolute value.
+ */
+#define EC_ABS(X) ((X) >= 0 ? (X) : -(X))
+
+/*****************************************************************************/
+
 extern char *ec_master_version_str;
 
 /*****************************************************************************/