--- old/src/share/vm/utilities/bitMap.inline.hpp 2017-04-09 17:53:29.291129025 -0400 +++ new/src/share/vm/utilities/bitMap.inline.hpp 2017-04-09 17:53:29.159122292 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -222,13 +222,13 @@ idx_t res_offset = l_offset; // check bits including and to the _left_ of offset's position - idx_t pos = res_offset & (BitsPerWord - 1); - bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos); + idx_t pos = bit_in_word(res_offset); + bm_word_t res = ~map(index) >> pos; // flip bits and shift for l_offset - if (res != ~(bm_word_t)0) { - // find the position of the 0-bit - for (; res & 1; res_offset++) { - res = res >> 1; + if (res != 0) { + // find the position of the 1-bit + for (; (res & 1) == 0; ++res_offset) { + res >>= 1; } assert(res_offset >= l_offset, "just checking"); return MIN2(res_offset, r_offset);