!7621 修改BitVector中关于位运算的告警

Merge pull request !7621 from liujia178/bitvector0523
This commit is contained in:
openharmony_ci 2024-05-31 10:24:15 +00:00 committed by Gitee
commit 031271c936
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ JSTaggedValue ContainersBitVector::BitVectorConstructor(EcmaRuntimeCallInfo* arg
auto* newBitSetVector = new std::vector<std::bitset<JSAPIBitVector::BIT_SET_LENGTH>>();
if (!length->IsZero()) {
int32_t capacity = (length->GetInt() >> JSAPIBitVector::TAGGED_VALUE_BIT_SIZE) + 1;
int32_t capacity = (length->GetInt() / JSAPIBitVector::BIT_SET_LENGTH) + 1;
std::bitset<JSAPIBitVector::BIT_SET_LENGTH> initBitSet;
newBitSetVector->resize(capacity, initBitSet);

View File

@ -428,8 +428,8 @@ void JSAPIBitVector::Resize(JSThread* thread, const JSHandle<JSAPIBitVector>& bi
[[maybe_unused]] ConcurrentApiScope<JSAPIBitVector, ModType::WRITE> scope(thread,
bitVector.GetTaggedValue().GetTaggedObject());
int length = bitVector->GetLength().GetInt();
uint32_t elementsLength = ((length - 1) >> JSAPIBitVector::TAGGED_VALUE_BIT_SIZE) + 1;
uint32_t newElementsLength = ((newSize - 1) >> JSAPIBitVector::TAGGED_VALUE_BIT_SIZE) + 1;
uint32_t elementsLength = ((length - 1) / BIT_SET_LENGTH) + 1;
uint32_t newElementsLength = ((newSize - 1) / BIT_SET_LENGTH) + 1;
JSHandle<JSNativePointer> np(thread, bitVector->GetNativePointer());
auto elements = reinterpret_cast<std::vector<std::bitset<BIT_SET_LENGTH>>*>(np->GetExternalPointer());