[gegl] tools: #define P2() at the top and call it SQR() instead in img_cmp
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] tools: #define P2() at the top and call it SQR() instead in img_cmp
- Date: Wed, 11 Aug 2010 06:10:24 +0000 (UTC)
commit 104a328459fef222856bc3ce50107f4fa181cf8f
Author: Martin Nordholts <martinn src gnome org>
Date: Tue Aug 10 21:17:11 2010 +0200
tools: #define P2() at the top and call it SQR() instead in img_cmp
tools/img_cmp.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/tools/img_cmp.c b/tools/img_cmp.c
index 5b28885..a01b200 100644
--- a/tools/img_cmp.c
+++ b/tools/img_cmp.c
@@ -2,6 +2,8 @@
#include <math.h>
#include <string.h>
+#define SQR(x) ((x) * (x))
+
gint
main (gint argc,
gchar **argv)
@@ -84,11 +86,10 @@ main (gint argc,
for (i=0;i<pixels;i++)
{
-#define P2(o) (((o))*((o)))
- gdouble diff = sqrt ( P2(a[0]-b[0])+
- P2(a[1]-b[1])+
- P2(a[2]-b[2])
- /*+P2(a[3]-b[3])*/);
+ gdouble diff = sqrt ( SQR(a[0]-b[0])+
+ SQR(a[1]-b[1])+
+ SQR(a[2]-b[2])
+ /*+SQR(a[3]-b[3])*/);
if (diff>=0.01)
{
wrong_pixels++;
@@ -117,11 +118,10 @@ main (gint argc,
if (wrong_pixels)
for (i=0;i<pixels;i++)
{
- gdouble diff = sqrt ( P2(a[0]-b[0])+
- P2(a[1]-b[1])+
- P2(a[2]-b[2])
- /*+P2(a[3]-b[3])*/);
-#undef P2
+ gdouble diff = sqrt ( SQR(a[0]-b[0])+
+ SQR(a[1]-b[1])+
+ SQR(a[2]-b[2])
+ /*+SQR(a[3]-b[3])*/);
if (diff>=0.01)
{
d[0]=(100-a[0])/100.0*64+32;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]