[m-rev.] for review: fix problems with empty bitmaps

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Mar 1 18:26:01 AEDT 2010


On Mon, 1 Mar 2010, Peter Wang wrote:

> Branches: main
>
> Fix bitmap predicates which did not work correctly with empty bitmaps.
>
> Note that `bitmap.to_string' now returns "<0:>" for an empty bitmap instead
> of "<0:00>".

Since bitmaps were in the 0.13 release it would be good to mention that
change in the NEWS file (on the off chance that some existing code
relies upon it.)

> library/bitmap.m:
>         Add `in_range_rexcl' to check an index is in the range [0, num_bits).
>
>         Fix bounds checks on empty bitmaps in `^ bits' and `copy_bytes'.
>
>         Simplify other bounds checks using `in_range_rexcl'.
>
>         Make `byte_index_for_bit' return -1 if its argument is negative,
>         instead of 0.  `byte_index_for_bit(NumBits - 1)' is used to get the
>         last byte index, so now loops over empty bitmaps will stop immediately
>         as the initial index must be greater than -1.
>
>         Make some code neater.
>
> tests/hard_coded/Mmakefile:
> tests/hard_coded/bitmap_empty.exp:
> tests/hard_coded/bitmap_empty.m:
>         Add a test case.

That looks okay.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list