OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 25 matching lines...) Expand all Loading... |
36 class BitArray { | 36 class BitArray { |
37 USING_FAST_MALLOC(BitArray); | 37 USING_FAST_MALLOC(BitArray); |
38 public: | 38 public: |
39 BitArray(bool value = false) | 39 BitArray(bool value = false) |
40 { | 40 { |
41 memset(m_data, value ? 0xFF : 0, sizeof(m_data)); | 41 memset(m_data, value ? 0xFF : 0, sizeof(m_data)); |
42 } | 42 } |
43 | 43 |
44 void set(unsigned index) | 44 void set(unsigned index) |
45 { | 45 { |
46 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); | 46 RELEASE_ASSERT(index < arraySize); |
47 m_data[index / 8] |= 1 << (index & 7); | 47 m_data[index / 8] |= 1 << (index & 7); |
48 } | 48 } |
49 | 49 |
50 void clear(unsigned index) | 50 void clear(unsigned index) |
51 { | 51 { |
52 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); | 52 RELEASE_ASSERT(index < arraySize); |
53 m_data[index / 8] &= ~(1 << (index & 7)); | 53 m_data[index / 8] &= ~(1 << (index & 7)); |
54 } | 54 } |
55 | 55 |
56 bool get(unsigned index) const | 56 bool get(unsigned index) const |
57 { | 57 { |
58 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); | 58 RELEASE_ASSERT(index < arraySize); |
59 return !!(m_data[index / 8] & (1 << (index & 7))); | 59 return !!(m_data[index / 8] & (1 << (index & 7))); |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 unsigned char m_data[arraySize / 8 + 1]; | 63 unsigned char m_data[arraySize / 8 + 1]; |
64 }; | 64 }; |
65 | 65 |
66 } // namespace WTF | 66 } // namespace WTF |
67 | 67 |
68 using WTF::BitArray; | 68 using WTF::BitArray; |
69 | 69 |
70 #endif // BitArray_h | 70 #endif // BitArray_h |
OLD | NEW |