aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-11 04:45:43 -0700
committerChris Robinson <[email protected]>2012-09-11 04:45:43 -0700
commitaaa81e00b75d0df6b83be5d3f6e54227110145ae (patch)
treea11eeb30c4ba5a98632e217303c2aad732e53dea /utils
parent1c44a9676800972a185d0e9b931ff3320267f1ef (diff)
Use HUGE_VAL instead of dividing by 0 for infinity, where possible
Diffstat (limited to 'utils')
-rw-r--r--utils/makehrtf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/utils/makehrtf.c b/utils/makehrtf.c
index e2e58d7c..65ca4bc1 100644
--- a/utils/makehrtf.c
+++ b/utils/makehrtf.c
@@ -51,6 +51,9 @@
*
*/
+/* Needed for 64-bit unsigned integer. */
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -58,9 +61,6 @@
#include <ctype.h>
#include <math.h>
-// Needed for 64-bit unsigned integer.
-#include "config.h"
-
// Rely (if naively) on OpenAL's header for the types used for serialization.
#include "AL/al.h"
@@ -68,6 +68,10 @@
#define M_PI 3.14159265358979323846
#endif
+#ifndef HUGE_VAL
+#define HUGE_VAL (1.0/0.0)
+#endif
+
// The epsilon used to maintain signal stability.
#define EPSILON (1e-15)
@@ -1149,7 +1153,7 @@ static int ReadAsciiAsDouble (TokenReaderT * tr, const char * filename, const El
else if (TrIsOperator (tr, "|"))
TrReadOperator (tr, "|");
if (type == ET_FP) {
- if (! TrReadFloat (tr, -1.0 / 0.0, 1.0 / 0.0, out)) {
+ if (! TrReadFloat (tr, -HUGE_VAL, HUGE_VAL, out)) {
fprintf (stderr, "Error: Bad read from file '%s'.\n", filename);
return (0);
}