Subject: Making more LP64 friendly.
To: None <tech-kern@NetBSD.org>
From: Matt Thomas <email@example.com>
Date: 11/23/2003 09:29:07
I like to commit the following changes to <sys/tree.h>. The primary
changes is to add a bit of const poisoning and to make the comparision
routine return long instead of int. On a LP64 platform, the current
use of int makes doing (note the additional const poisoning)
cmp(const struct type *a, const struct type *b)
return b->f - a->f;
impossible if f is wider than an int. That's an unneeded complication.
The other thing is adding a const to the SPLAY_FIND function since that
element is read-only. However, my problem with SPLAY_FIND is that takes
an element rather than a key type. That could be fixed by using two
comparision routines, one for comparing struct and one to compare
a element and a key type. Right now I work around that by moving the
key item to the beginning of the struct and casting. But that's evil.
Matt Thomas email: firstname.lastname@example.org
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this