Cleanup similar issues in UniformGrid3D

MolOps.cpp: docs patch
This commit is contained in:
Greg Landrum
2007-05-16 08:14:44 +00:00
parent 78ea71bdbc
commit 8b3de2e02e
6 changed files with 34 additions and 11 deletions

View File

@@ -29,14 +29,18 @@ namespace RDKit {
}
unsigned int DiscreteValueVect::getVal(unsigned int i) const {
RANGE_CHECK(0, i, d_length-1);
if(i >= d_length){
throw IndexErrorException(i);
}
unsigned int shift = d_bitsPerVal*(i%d_valsPerInt);
unsigned int intId = i/d_valsPerInt;
return ( (d_data[intId] >> shift) & d_mask);
}
void DiscreteValueVect::setVal(unsigned int i, unsigned int val) {
RANGE_CHECK(0, i, d_length-1);
if(i >= d_length){
throw IndexErrorException(i);
}
if ((val & d_mask) != val) {
throw ValueErrorException("Value out of range");
}