Bug 1462544 - Use <algorithm> functions to fill and copy data in Bitmap.* rather than PodOperations.h functions. r=jandem

--HG--
extra : rebase_source : 3e96b8528ffe20339186c9c1363214fa2ddc7539
This commit is contained in:
Jeff Walden 2018-05-18 11:44:44 -07:00
Родитель 47bf188b58
Коммит 8031f784af
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -6,6 +6,8 @@
#include "ds/Bitmap.h"
#include <algorithm>
using namespace js;
SparseBitmap::~SparseBitmap()
@ -33,7 +35,7 @@ SparseBitmap::createBlock(Data::AddPtr p, size_t blockId)
BitBlock* block = js_new<BitBlock>();
if (!block || !data.add(p, blockId, block))
oomUnsafe.crash("Bitmap OOM");
PodZero(block);
std::fill(block->begin(), block->end(), 0);
return *block;
}

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/MemoryChecking.h"
#include "mozilla/PodOperations.h"
#include <algorithm>
#include <stddef.h>
@ -54,7 +53,9 @@ class DenseBitmap
void copyBitsFrom(size_t wordStart, size_t numWords, uintptr_t* source) {
MOZ_ASSERT(wordStart + numWords <= data.length());
mozilla::PodCopy(&data[wordStart], source, numWords);
// Use std::copy and not std::copy_n because the former requires no
// overlap and so provides extra opportunity to optimize.
std::copy(source, source + numWords, &data[wordStart]);
}
void bitwiseOrRangeInto(size_t wordStart, size_t numWords, uintptr_t* target) const {