You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (Updated) (JIRA)" <ji...@apache.org> on 2012/03/16 17:19:38 UTC

[jira] [Updated] (LUCENE-3738) Be consistent about negative vInt/vLong

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

Michael McCandless updated LUCENE-3738:
---------------------------------------

    Attachment: LUCENE-3738.patch

Patch, just adding assert in writeVLong that i >=0, and also strengthening existing assert in readVInt to check that top 4 (not just top 1) bits are 0.
                
> Be consistent about negative vInt/vLong
> ---------------------------------------
>
>                 Key: LUCENE-3738
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3738
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3738.patch, LUCENE-3738.patch, LUCENE-3738.patch
>
>
> Today, write/readVInt "allows" a negative int, in that it will encode and decode correctly, just horribly inefficiently (5 bytes).
> However, read/writeVLong fails (trips an assert).
> I'd prefer that both vInt/vLong trip an assert if you ever try to write a negative number... it's badly trappy today.  But, unfortunately, we sometimes rely on this... had we had this assert in 'since the beginning' we could have avoided that.
> So, if we can't add that assert in today, I think we should at least fix readVLong to handle negative longs... but then you quietly spend 9 bytes (even more trappy!).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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