Commit Graph

2 Commits

Author SHA1 Message Date
Julien Fischer
85a1eb5cf2 Access bytes in bitmaps as uint8s.
library/bitmap.m:
     Add functions for accessing bytes in bitmaps as uint8 values.

     Add predicates for setting bytes in bitmaps as uint8 values.

     Add a det version of from_string/1.

     Fix a typo in the description of is_empty/1.

tests/hard_coded/bitmap_bytes.{m,exp}:
     Extend this test to cover uint8 access to bitmaps.

NEWS:
     Announce the new predicates and functions.
2018-01-02 18:49:06 -05:00
Julien Fischer
f76e0407e5 Fix some error reporting in bitmap module.
The functions byte/2 and 'byte :='/2 both throw a bitmap_error/1 exception if
the given byte index is out of bounds.  The error message returned as part of
the exception reports the byte index that is out of bounds but then gives the
valid bounds of *bit* indexes in the bitmap.   There are two possible fixes:

     1. report the out of bounds index as the bit index of the start of the byte.
     2. report the valid bounds of the of byte indexes in the bitmap.

This change implements the latter.

Style and formatting fixes to the bitmap module.

library/bitmap.m:
     Make the above fix.

     Add separate predicates for reporting out of bounds bit and byte
     indexes.

     Do not provide erroneous functions that duplicate the functionality of,
     or forward their work, to erroneous predicates of the same name.

     Add the predicate is_empty/1.

     Remove some unnecessary module qualification.

     Use state variable notation in more spots.

tests/hard_coded/Mmakefile:
tests/hard_coded/bitmap_bytes.{m,exp}:
     Add a new test for byte lookups in bitmaps -- this wasn't covered
     by the existing test cases.

tests/hard_coded/bitmap_empty.exp:
tests/hard_coded/btimap_test.exp:
     Conform to the above changes.

NEWS:
     Announce the addition of bitmap.is_empty/1.
2017-12-29 00:44:51 -05:00