summaryrefslogtreecommitdiff
path: root/dtrain/dtrain.h
diff options
context:
space:
mode:
Diffstat (limited to 'dtrain/dtrain.h')
-rw-r--r--dtrain/dtrain.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h
index 84f3f1f5..cfc3f460 100644
--- a/dtrain/dtrain.h
+++ b/dtrain/dtrain.h
@@ -85,5 +85,11 @@ inline void printWordIDVec(vector<WordID>& v)
}
}
+template<typename T>
+inline T sign(T z) {
+ if (z == 0) return 0;
+ return z < 0 ? -1 : +1;
+}
+
#endif