Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/orc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Nazar <nazard@nazar.ca>2019-08-31 18:08:58 +0300
committerDoug Nazar <nazard@nazar.ca>2019-08-31 18:08:58 +0300
commit8c7c61d2014a9190fec4c6c97f8a759916ca9fc7 (patch)
treec6dd652983f94086afdfc154f3affb0c2a59ddd0 /orc-test/orctest.c
parent63f6cfac0fa9dd3263540eb0d78fc6a20af9016c (diff)
orctest: Fix ULP compare and make compatible with clang
Diffstat (limited to 'orc-test/orctest.c')
-rw-r--r--orc-test/orctest.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/orc-test/orctest.c b/orc-test/orctest.c
index 4b07823..614421b 100644
--- a/orc-test/orctest.c
+++ b/orc-test/orctest.c
@@ -522,12 +522,16 @@ float_compare (OrcArray *array1, OrcArray *array2, int i, int j)
case 4:
if (isnan(*(float *)ptr1) && isnan(*(float *)ptr2)) return TRUE;
if (*(float *)ptr1 == *(float *)ptr2) return TRUE;
- if ((*(float *)ptr1 < 0.0) == (*(float *)ptr2 < 0.0) && (*(orc_uint32 *)ptr1 - *(orc_uint32 *)ptr2) <= 2) return TRUE;
+ if ((*(float *)ptr1 < 0.0) == (*(float *)ptr2 < 0.0) &&
+ abs((orc_int32)(*(orc_uint32 *)ptr1 - *(orc_uint32 *)ptr2) <= 2))
+ return TRUE;
return FALSE;
case 8:
if (isnan(*(double *)ptr1) && isnan(*(double *)ptr2)) return TRUE;
if (*(double *)ptr1 == *(double *)ptr2) return TRUE;
- if ((*(double *)ptr1 < 0.0) == (*(double *)ptr2 < 0.0) && (*(orc_uint64 *)ptr1 - *(orc_uint64 *)ptr2) <= 2) return TRUE;
+ if ((*(double *)ptr1 < 0.0) == (*(double *)ptr2 < 0.0) &&
+ llabs((orc_int64)(*(orc_uint64 *)ptr1 - *(orc_uint64 *)ptr2) <= 2))
+ return TRUE;
return FALSE;
}
return FALSE;