[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: ordered indexing for integers
Hallvard B Furuseth wrote:
I wrote:
It makes more sense to check for ridiculous-sized numbers before
parsing them and just output a min/max value depending on sign. (Or
right-truncate e.g. n*12 digits and add n*5 to the length.)
Committed. Chopping n*7 digits and adding n*3 to the binary-integer
length instead. More wasteful of the exponent bits, but leaves fewer
digits to parse.
Could possibly chop just as many digits as needed and compute the length
more exactly, but I wasn't up to figuring out what algorithm to use so
an exponent taken from the parsed digits could add to overlap an
exponent taken from chopping. Will fiddle a bit with it now and see if
I come up with something.
One detail: Looks like lutil_str2bin() could use a ctx parameter,
for the temporary malloc/free in that function.
Good idea. I'll add that.
This change was unnecessary:
@@ -2114,49 +2116,69 @@
static int
integerVal2Key(
- struct berval *val,
+ struct berval val,
struct berval *key,
- struct berval *tmp
+ struct berval itmp
)
{
Passing structures by value may be perfectly legal now, but we never do it in
this source base. Why start now?
--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/