1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
159 return word_align_up(bit) == bit; |
159 return word_align_up(bit) == bit; |
160 } |
160 } |
161 |
161 |
162 // Set or clear the specified bit. |
162 // Set or clear the specified bit. |
163 inline void set_bit(idx_t bit); |
163 inline void set_bit(idx_t bit); |
164 void clear_bit(idx_t bit); |
164 inline void clear_bit(idx_t bit); |
165 |
165 |
166 // Atomically set or clear the specified bit. |
166 // Atomically set or clear the specified bit. |
167 bool par_set_bit(idx_t bit); |
167 inline bool par_set_bit(idx_t bit); |
168 bool par_clear_bit(idx_t bit); |
168 inline bool par_clear_bit(idx_t bit); |
169 |
169 |
170 // Put the given value at the given offset. The parallel version |
170 // Put the given value at the given offset. The parallel version |
171 // will CAS the value into the bitmap and is quite a bit slower. |
171 // will CAS the value into the bitmap and is quite a bit slower. |
172 // The parallel version also returns a value indicating if the |
172 // The parallel version also returns a value indicating if the |
173 // calling thread was the one that changed the value of the bit. |
173 // calling thread was the one that changed the value of the bit. |