about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorAndrew Poelstra <apoelstra@wpsoftware.net>2014-07-02 08:24:55 -0700
committerAndrew Poelstra <apoelstra@wpsoftware.net>2014-07-02 12:36:00 -0700
commita698b81ebfe02a614f9b41e68c6b604597a81229 (patch)
tree17eb9394072a19419faef3bb9486a0d183771a11 /src/rustllvm/ExecutionEngineWrapper.cpp
parent2d23319e334a4fa1a6ec440b2cb0e48d0cadc542 (diff)
downloadrust-a698b81ebfe02a614f9b41e68c6b604597a81229.tar.gz
rust-a698b81ebfe02a614f9b41e68c6b604597a81229.zip
collections::bitv: ensure correct masking behaviour
The internal masking behaviour for `Bitv` is now defined as:
  - Any entirely words in self.storage must be all zeroes.
  - Any partially used words may have anything at all in their
    unused bits.

This means:
  - When decreasing self.nbits, care must be taken that any
    no-longer-used words are zeroed out.

  - When increasing self.nbits, care must be taken that any
    newly-unmasked bits are set to their correct values.

  - When reading words, care should be taken that the values of
    unused bits are not used. (Preferably, use `Bitv::mask_words`
    which zeroes them out for you.)

The old behaviour was that every unused bit was always set to
zero. The problem with this is that unused bits are almost never
read, so forgetting to do this will result in very subtle and
hard-to-track down bugs. This way the responsibility for masking
falls on the places which might cause unused bits to be read: for
now, this is only `Bitv::mask_words` and `BitvSet::insert`.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions