* [PATCH] befs (3/5): binary search microoptimisation
@ 2004-05-13 18:21 Sergey S. Kostyliov
0 siblings, 0 replies; only message in thread
From: Sergey S. Kostyliov @ 2004-05-13 18:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Will Dyson
Move value initialisation out of the loop body.
===== fs/befs/btree.c 1.6 vs edited =====
--- 1.6/fs/befs/btree.c Sun Jul 13 19:55:50 2003
+++ edited/fs/befs/btree.c Thu May 13 19:45:39 2004
@@ -372,12 +372,12 @@
thiskey = befs_bt_get_key(sb, node, mid, &keylen);
eq = befs_compare_strings(thiskey, keylen, findkey,
findkey_len);
- *value = fs64_to_cpu(sb, valarray[mid]);
if (eq == 0) {
befs_debug(sb, "<--- befs_find_key() found %s at %d",
thiskey, mid);
+ *value = fs64_to_cpu(sb, valarray[mid]);
return BEFS_BT_MATCH;
}
if (eq > 0)
@@ -387,6 +387,8 @@
}
if (eq < 0)
*value = fs64_to_cpu(sb, valarray[mid + 1]);
+ else
+ *value = fs64_to_cpu(sb, valarray[mid]);
befs_debug(sb, "<--- befs_find_key() found %s at %d", thiskey, mid);
return BEFS_BT_PARMATCH;
}
--
Best regards,
Sergey S. Kostyliov <rathamahata@php4.ru>
Public PGP key: http://sysadminday.org.ru/rathamahata.asc
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-05-13 18:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13 18:21 [PATCH] befs (3/5): binary search microoptimisation Sergey S. Kostyliov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®