Re: [RFC] B+Tree library V2

From: JÃrn Engel
Date: Thu Jan 08 2009 - 14:46:56 EST


On Thu, 8 January 2009 17:50:04 +0100, Johannes Berg wrote:
>
> I see this:
>
>
> - * Second trick is to special-case the key "0" or NUL. As seen above, this
> - * value indicates an unused slot, so such a value should not be stored in the
> - * tree itself. Instead it is stored in the null_ptr field in the btree_head.
>
> Does that mean that wasn't true, and I can store a 0 key?

Ahh, don't look at that! The embarrassment is unbearable! Go away!

Yes, I used to have a special exception for a 0 key. But I also have
a special exception for a NULL value and can test against that instead
of testing against a 0 key. It is even faster, because the value is not
variable-sized. In hindsight it is hard to explain why I ever did that.

JÃrn

--
Unless something dramatically changes, by 2015 we'll be largely
wondering what all the fuss surrounding Linux was really about.
-- Rob Enderle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/