bitMap.inline.hpp revision 342
1879N/A * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 1010N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1010N/A * This code is free software; you can redistribute it and/or modify it 1010N/A * under the terms of the GNU General Public License version 2 only, as 1010N/A * published by the Free Software Foundation. 1010N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1010N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1010N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1010N/A * version 2 for more details (a copy is included in the LICENSE file that 1010N/A * You should have received a copy of the GNU General Public License version 1010N/A * 2 along with this work; if not, write to the Free Software Foundation, 1010N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1010N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1472N/A * CA 95054 USA or visit www.sun.com if you need additional information or return false;
// Someone else beat us to it. return false;
// Someone else beat us to it. // check bits including and to the _left_ of offset's position // find the position of the 1-bit // skip over all word length 0-bit runs // found a 1, return the offset assert(
res &
1,
"tautology; see loop condition");
// check bits including and to the _left_ of offset's position // find the position of the 0-bit // skip over all word length 1-bit runs // found a 0, return the offset assert(!(
res &
1),
"tautology; see loop condition");
// check bits including and to the _left_ of offset's position // find the position of the 1-bit // skip over all word length 0-bit runs // found a 1, return the offset assert(
res &
1,
"tautology; see loop condition");
// Returns a bit mask for a range of bits [beg, end) within a single word. Each // bit in the mask is 0 if the bit is in the range, 1 if not in the range. The // returned mask can be used directly to clear the range, or inverted to set the // range. Note: end must not be 0. assert(
end != 0,
"does not work when end == 0");
"must be a single-word range");
// Check for integer arithmetic overflow.