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

Knut Anders Hatlen updated DERBY-2191:
--------------------------------------

    Attachment: grow.diff

It seems to me that grow() is unnecessarily complex. It has some extra logic to 
handle the case where there are enough free bits in the last byte, but that 
does not seem any different from the case where the byte array contains enough 
free space. Also, it loops through the previously unused bytes and clears them, 
which should be unnecessary because the unused bytes should always be 0 (part 
of the invariant).

grow.diff removes the unneeded special case and the clearing of the unused 
bytes. It also adds a call to ASSERT(invariantHolds()) in grow() and shrink(). 
Derbyall and the JUnit tests passed.

> Cleanup of FormatableBitSet
> ---------------------------
>
>                 Key: DERBY-2191
>                 URL: https://issues.apache.org/jira/browse/DERBY-2191
>             Project: Derby
>          Issue Type: Improvement
>          Components: Miscellaneous
>    Affects Versions: 10.2.1.6
>            Reporter: Dyre Tjeldvoll
>         Assigned To: Dyre Tjeldvoll
>            Priority: Trivial
>             Fix For: 10.3.0.0
>
>         Attachments: anysetbit.v1.diff, anysetbit.v1.stat, anysetbit.v2.diff, 
> bitops.v1.diff, bitops.v1.stat, bitops.v2.diff, bitops.v2.stat, 
> bitops.v3.diff, bitopt.v1.diff, bitopt.v1.stat, bitopt.v2.diff, 
> boundarycheck.v1.diff, boundarycheck.v1.stat, cleanup2191.diff, 
> cleanup2191.stat, deadcode.v1.diff, deadcode.v2.diff, fbstst.v1.diff, 
> fbstst.v1.stat, FormatableBitSetTest.java, grow.diff, numbitsset.v1.diff, 
> numbitsset.v1.stat, numbitsset.v2.diff, numbitstest.diff, shrink.v1.diff, 
> shrink.v1.stat, shrink.v2.diff, unusedmethods.v1.diff, unusedmethods.v1.stat, 
> valuenotnull.v1.diff, valuenotnull.v1.stat
>
>
> The implementation of FormatableBitSet could be streamlined. Dead code can be 
> removed and the implementation of some methods can be simplified.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to