| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#include <stdlib.h> |
| 5 |
#include <wchar.h> |
| 6 |
#include "src/precommondefs.h" |
| 7 |
#include "tscmp.h" |
| 8 |
|
| 9 |
int |
| 10 |
pypy_tscmp(const char *a, const char *b, Signed len_a, Signed len_b) |
| 11 |
{ |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
volatile Signed length; |
| 17 |
volatile const char *left; |
| 18 |
volatile const char *right; |
| 19 |
Signed i; |
| 20 |
volatile char result; |
| 21 |
|
| 22 |
|
| 23 |
length = len_b; |
| 24 |
left = NULL; |
| 25 |
right = b; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
if (len_a == length) { |
| 31 |
left = *((volatile const char**)&a); |
| 32 |
result = 0; |
| 33 |
} |
| 34 |
if (len_a != length) { |
| 35 |
left = b; |
| 36 |
result = 1; |
| 37 |
} |
| 38 |
|
| 39 |
for (i=0; i < length; i++) { |
| 40 |
result |= *left++ ^ *right++; |
| 41 |
} |
| 42 |
|
| 43 |
return (result == 0); |
| 44 |
} |