lkml.org 
[lkml]   [2017]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 1/2] lib/btree.c: optimise the code by previously getpos function
On Thu, May 18, 2017 at 4:40 PM, Leno Hou <lenohou@gmail.com> wrote:
> Rework the getpos() helper function and use it to remove various
> open-coded implemetnations of its funtionality.

> for ( ; height > 1; height--) {
> - for (i = 0; i < geo->no_pairs; i++)
> - if (keycmp(geo, node, i, key) <= 0)
> - break;
> - if (i == geo->no_pairs)
> + i = getpos(geo, node, key);
> + if (i < 0)
> return -ENOENT;

Now it makes sense to

return i;

instead.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-05-18 17:50    [W:0.074 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site