diff --git a/test/buffer-diff.c b/test/buffer-diff.c index 5463c2987..45942c498 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -28,6 +28,7 @@ #endif #include +#include #ifdef HAVE_UNISTD_H #include #endif @@ -93,7 +94,7 @@ buffer_diff_core (unsigned char *_buf_a, unsigned char value_a = (row_a[x] >> (channel*8)); unsigned char value_b = (row_b[x] >> (channel*8)); unsigned int diff; - diff = value_a - value_b; + diff = abs (value_a - value_b); diff *= 4; /* emphasize */ if (diff > 255) diff = 255;