summaryrefslogtreecommitdiff
path: root/mysys/my_handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_handler.c')
-rw-r--r--mysys/my_handler.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index 6e634dc447c..87e526d0ea3 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -43,7 +43,7 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
return 0;
if (skip_end_space && a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
We are using space compression. We have to check if longer key
has next character < ' ', in which case it's less than the shorter
@@ -57,12 +57,12 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
/* put shorter key in a */
a_length= b_length;
a= b;
- swap= -1 ^ 1; /* swap sign of result */
+ swap= -1; /* swap sign of result */
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
return 0;
}