|
[yoda-svn] r519 - trunk/include/YODAblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 6 14:01:03 BST 2012
Author: dgrell Date: Mon Aug 6 14:01:03 2012 New Revision: 519 Log: size_t is never negative Modified: trunk/include/YODA/Axis1D.h trunk/include/YODA/Histo1D.h Modified: trunk/include/YODA/Axis1D.h ============================================================================== --- trunk/include/YODA/Axis1D.h Fri Aug 3 12:20:01 2012 (r518) +++ trunk/include/YODA/Axis1D.h Mon Aug 6 14:01:03 2012 (r519) @@ -212,8 +212,8 @@ /// Merge a series of bins, between the bins identified by indices @a from and @a to void mergeBins(size_t from, size_t to) { // Correctness checking - if (from < 0 || from >= numBins()) throw RangeError("First index is out of range!"); - if (to < 0 || to >= numBins()) throw RangeError("Second index is out of range!"); + if (from >= numBins()) throw RangeError("First index is out of range!"); + if ( to >= numBins()) throw RangeError("Second index is out of range!"); if (_bins[from].xMin() > _bins[to].xMin()) throw RangeError("The starting bin is greater than ending bin!"); if (_gapInRange(from, to)) throw RangeError("Bin ranges containing binning gaps cannot be merged!"); @@ -261,8 +261,8 @@ /// Remove a bin range void eraseBins(size_t from, size_t to) { - if (from < 0 || from >= numBins()) throw ("First index is out of range!"); - if (to < 0 || to >= numBins()) throw ("Second index is out of range!"); + if (from >= numBins()) throw ("First index is out of range!"); + if ( to >= numBins()) throw ("Second index is out of range!"); if (_bins[from].xMin() > _bins[to].xMin()) throw RangeError("The starting bin is greater than ending bin!"); _bins.erase(_bins.begin() + from, _bins.begin() + to + 1); _updateAxis(); Modified: trunk/include/YODA/Histo1D.h ============================================================================== --- trunk/include/YODA/Histo1D.h Fri Aug 3 12:20:01 2012 (r518) +++ trunk/include/YODA/Histo1D.h Mon Aug 6 14:01:03 2012 (r519) @@ -280,8 +280,8 @@ /// Get the integrated area of the histogram between bins @a binindex1 and @a binindex2. double integral(size_t binindex1, size_t binindex2) const { assert(binindex1 > binindex2); - if (binindex1 < 0 || binindex1 >= numBins()) throw RangeError("binindex1 is out of range"); - if (binindex2 < 0 || binindex2 >= numBins()) throw RangeError("binindex2 is out of range"); + if (binindex1 >= numBins()) throw RangeError("binindex1 is out of range"); + if (binindex2 >= numBins()) throw RangeError("binindex2 is out of range"); double rtn = 0; for (size_t i = binindex1; i < binindex2; ++i) { rtn += bin(i).area();
More information about the yoda-svn mailing list |