[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ordered indexing for integers

Hallvard B Furuseth wrote:
What representation are you planning?  My thoughts about it tend towards
DER-inspired formats, something like this:

for values small enough to keep the exact value in the index:
  <0x80 + sign*(#bytes needed)> <those bytes of 2's complement value>
for larger absoulte values:
  same, but for the sake of speed read the value as hex, so we only
  need read the first digits (skipping initial zeros).
for huge values, something like:
  (value < 0 ? 0 : 255),
  <0x8000... + sign*#length octets>
  <initial part of two's complement value-as-hex>

(And if there is going to be a slapd.conf-option, that could just as
well be an option with the max index-key size.)

Too complicated?

I guess you're really describing something like floating-point representation, except our exponents are always positive. That might be the better way to go.
-- 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/