lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrien Grand (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LUCENE-5759) Add PackedInts.unsignedBitsRequired
Date Sat, 14 Jun 2014 02:13:02 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-5759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Adrien Grand updated LUCENE-5759:
---------------------------------

    Attachment: LUCENE-5759.patch

New iteration. I tried to decouple the rounding logic from the computation of the number of
bits required in DirectWriter. Consumers first need to call bitsRequired or unsignedBitsRequuired
depending on their needs, and then to pass the result to DirectWriter.roundBits to get an
amount of bits per value that is supported by the writer.

> Add PackedInts.unsignedBitsRequired
> -----------------------------------
>
>                 Key: LUCENE-5759
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5759
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: 4.9
>
>         Attachments: LUCENE-5759.patch, LUCENE-5759.patch
>
>
> Across the code base, we have lots of:
> {code}
> long minValue, maxValue;
> final long delta = maxValue - minValue;
> final int bitsRequired = delta < 0 64 : Packedints.bitsRequired(delta);
> {code}
> {{Packedints.bitsRequired(delta)}} doesn't work directly in that case since it expects
a positive value. And that is important that it does so in order to get an error instead of
silently being super wasteful if a negative value is provided.
> Yet in some cases such as the one depicted above, the value should be interpreted as
an unsigned long. So I propose to add another {{bitsRequired}} method that would interpret
the value as unsigned.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message