Skip to content

Commit e004cea

Browse files
committed
Add required macro
1 parent 60eccb5 commit e004cea

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

middleware/src/c_utils.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#include <assert.h>
33
#include <math.h>
44

5+
/* Epsilon for float comparisons */
6+
#define FLOAT_EPSILON (0.0001f)
7+
58
void endian_swap(void *ptr, int size)
69
{
710
char *p = (char *)ptr;
@@ -23,7 +26,7 @@ unsigned char reverse_bits(unsigned char b)
2326

2427
float linear_interpolate(float x, float x1, float x2, float y1, float y2)
2528
{
26-
assert(fabs(x2 - x1) > 0.0001f);
29+
assert(fabs(x2 - x1) > FLOAT_EPSILON);
2730

2831
return y1 + ((x - x1) * (y2 - y1) / (x2 - x1));
2932
}

0 commit comments

Comments
 (0)