diff options
author | Peter Osterlund <petero2@telia.com> | 2006-09-25 18:28:22 +0200 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-09-25 18:28:22 +0200 |
commit | 5e0942e9d2471ec6f79dae65b839f76c50d9d6de (patch) | |
tree | ce49ccc2ef18f4e7c9b5e1a895603d9487096574 /synaptics.c | |
parent | e15b9432ce05a2f7182f75771f59aca9f96ce94d (diff) |
Implement a SQR macro to simplify the code.
Diffstat (limited to 'synaptics.c')
-rw-r--r-- | synaptics.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synaptics.c b/synaptics.c index 93c5a12..faf006b 100644 --- a/synaptics.c +++ b/synaptics.c @@ -103,6 +103,8 @@ typedef enum { #define TIME_DIFF(a, b) ((int)((a)-(b))) #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) +#define SQR(x) ((x) * (x)) + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -634,7 +636,7 @@ DeviceInit(DeviceIntPtr dev) static int move_distance(int dx, int dy) { - return xf86sqrt((dx * dx) + (dy * dy)); + return xf86sqrt(SQR(dx) + SQR(dy)); } /* @@ -691,7 +693,7 @@ circular_edge_detection(SynapticsPrivate *priv, int x, int y) double relX, relY, relR; relative_coords(priv, x, y, &relX, &relY); - relR = relX * relX + relY * relY; + relR = SQR(relX) + SQR(relY); if (relR > 1) { /* we are outside the ellipse enclosed by the edge parameters */ |