diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-18 05:22:34 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-18 05:22:34 +0100 |
commit | 032bf6553346537cb02d0406c05548c8aa23c81f (patch) | |
tree | 231b695138da8661547e331c3b43c7ee438c5194 | |
parent | d4a7728dc3b37e2956034f18fc26c04bc0aa2b0e (diff) | |
download | busybox-w32-032bf6553346537cb02d0406c05548c8aa23c81f.tar.gz busybox-w32-032bf6553346537cb02d0406c05548c8aa23c81f.tar.bz2 busybox-w32-032bf6553346537cb02d0406c05548c8aa23c81f.zip |
diff: defeat gcc's optimization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/diff.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/editors/diff.c b/editors/diff.c index af6917a03..b89bbc1dc 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -435,7 +435,10 @@ static int *create_J(FILE_and_pos_t ft[2], int nlen[2], off_t *ix[2]) | |||
435 | tok = read_token(&ft[i], tok); | 435 | tok = read_token(&ft[i], tok); |
436 | if (!(tok & TOK_EMPTY)) { | 436 | if (!(tok & TOK_EMPTY)) { |
437 | /* Hash algorithm taken from Robert Sedgewick, Algorithms in C, 3d ed., p 578. */ | 437 | /* Hash algorithm taken from Robert Sedgewick, Algorithms in C, 3d ed., p 578. */ |
438 | hash = hash * 128 - hash + TOK2CHAR(tok); | 438 | /*hash = hash * 128 - hash + TOK2CHAR(tok); |
439 | * gcc insists on optimizing above to "hash * 127 + ...", thus... */ | ||
440 | unsigned o = hash - TOK2CHAR(tok); | ||
441 | hash = hash * 128 - o; /* we want SPEED here */ | ||
439 | continue; | 442 | continue; |
440 | } | 443 | } |
441 | if (nlen[i]++ == sz) { | 444 | if (nlen[i]++ == sz) { |