Bug 935789, part 1: Kill most uses of prbit.h, r=ehsan

--HG--
extra : rebase_source : 4c44e60c72e0ece3cea7ed1cf79079bd2a1b6487
This commit is contained in:
Joshua Cranmer 2013-11-12 18:22:38 -06:00
parent d75a37769c
commit 08036d15e9
11 changed files with 21 additions and 27 deletions

View File

@ -10,10 +10,10 @@
#include "nsAttrAndChildArray.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryReporting.h"
#include "nsMappedAttributeElement.h"
#include "prbit.h"
#include "nsString.h"
#include "nsHTMLStyleSheet.h"
#include "nsRuleWalker.h"
@ -772,7 +772,7 @@ nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
} while (size < minSize);
}
else {
size = 1u << PR_CeilingLog2(minSize);
size = 1u << mozilla::CeilingLog2(minSize);
}
bool needToInitialize = !mImpl;

View File

@ -15,10 +15,10 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "mozilla/MathAlgorithms.h"
#include "mozilla/X11Util.h"
#include "prenv.h"
#include "prbit.h" // for PR_FLOOR_LOG2
#include "GLContextProvider.h"
#include "GLLibraryLoader.h"
#include "nsDebug.h"
@ -299,8 +299,7 @@ GLXLibrary::CreatePixmap(gfxASurface* aSurface)
return None;
}
const XRenderDirectFormat& direct = format->direct;
int alphaSize;
PR_FLOOR_LOG2(alphaSize, direct.alphaMask + 1);
int alphaSize = FloorLog2(direct.alphaMask + 1);
NS_ASSERTION((1 << alphaSize) - 1 == direct.alphaMask,
"Unexpected render format with non-adjacent alpha bits");

View File

@ -18,7 +18,6 @@
#include "nsWeakReference.h"
#include "nsClassHashtable.h"
#include "nsCRT.h"
#include "prbit.h"
#include "nsTraceRefcnt.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/MemoryReporting.h"

View File

@ -24,7 +24,6 @@
#endif
#include "prthread.h"
#include "prbit.h"
#include "private/pprio.h"

View File

@ -13,6 +13,7 @@
#include "nsIMemoryReporter.h"
#include "nsCRT.h"
#include "nsReadableUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Telemetry.h"
#include <algorithm>
@ -429,7 +430,7 @@ nsMemoryCacheDevice::EvictionList(nsCacheEntry * entry, int32_t deltaSize)
int32_t size = deltaSize + (int32_t)entry->DataSize();
int32_t fetchCount = std::max(1, entry->FetchCount());
return std::min(PR_FloorLog2(size / fetchCount), kQueueCount - 1);
return std::min((int)mozilla::FloorLog2(size / fetchCount), kQueueCount - 1);
}

View File

@ -38,7 +38,6 @@
#include "plbase64.h"
#include "prmem.h"
#include "prnetdb.h"
#include "prbit.h"
#include "zlib.h"
#include <algorithm>
#include "nsDebug.h"

View File

@ -55,7 +55,6 @@
#include "rdf.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "prbit.h"
#include "mozilla/HashFunctions.h"
using namespace mozilla;

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <string.h>
#include "prbit.h"
#include "mozilla/MathAlgorithms.h"
#include "nsSupportsArray.h"
#include "nsSupportsArrayEnumerator.h"
#include "nsIObjectInputStream.h"
@ -129,7 +129,7 @@ void nsSupportsArray::GrowArrayBy(int32_t aGrowBy)
// Select the next power-of-two size in bytes above that if newSize is
// not a power of two.
if (newSize & (newSize - 1))
newSize = 1u << PR_CeilingLog2(newSize);
newSize = 1u << mozilla::CeilingLog2(newSize);
newCount = newSize / sizeof(mArray[0]);
}

View File

@ -3,12 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryReporting.h"
#include <stdlib.h>
#include "nsVoidArray.h"
#include "nsQuickSort.h"
#include "prbit.h"
#include "nsISupportsImpl.h" // for nsTraceRefcnt
#include "nsAlgorithm.h"
@ -239,7 +239,7 @@ bool nsVoidArray::GrowArrayBy(int32_t aGrowBy)
}
else
{
PR_CEILING_LOG2(newSize, newSize);
newSize = mozilla::CeilingLog2(newSize);
newCapacity = CAPACITYOF_IMPL(1u << newSize);
}
}

View File

@ -9,9 +9,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prbit.h"
#include "pldhash.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/MathAlgorithms.h"
#include "nsDebug.h" /* for PR_ASSERT */
#include "nsAlgorithm.h"
#include "mozilla/Likely.h"
@ -45,22 +45,22 @@
table_->recursionLevel == IMMUTABLE_RECURSION_LEVEL)
#define INCREMENT_RECURSION_LEVEL(table_) \
PR_BEGIN_MACRO \
do { \
if (table_->recursionLevel != IMMUTABLE_RECURSION_LEVEL) \
++table_->recursionLevel; \
PR_END_MACRO
} while(0)
#define DECREMENT_RECURSION_LEVEL(table_) \
PR_BEGIN_MACRO \
do { \
if (table->recursionLevel != IMMUTABLE_RECURSION_LEVEL) { \
MOZ_ASSERT(table->recursionLevel > 0); \
--table->recursionLevel; \
} \
PR_END_MACRO
} while(0)
#else
#define INCREMENT_RECURSION_LEVEL(table_) PR_BEGIN_MACRO PR_END_MACRO
#define DECREMENT_RECURSION_LEVEL(table_) PR_BEGIN_MACRO PR_END_MACRO
#define INCREMENT_RECURSION_LEVEL(table_) do { } while(0)
#define DECREMENT_RECURSION_LEVEL(table_) do { } while(0)
#endif /* defined(DEBUG) */
@ -206,8 +206,7 @@ PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
if (capacity < PL_DHASH_MIN_SIZE)
capacity = PL_DHASH_MIN_SIZE;
int log2;
PR_CEILING_LOG2(log2, capacity);
int log2 = CeilingLog2(capacity);
capacity = 1u << log2;
if (capacity > PL_DHASH_MAX_SIZE)
@ -661,8 +660,7 @@ PL_DHashTableEnumerate(PLDHashTable *table, PLDHashEnumerator etor, void *arg)
if (capacity < PL_DHASH_MIN_SIZE)
capacity = PL_DHASH_MIN_SIZE;
uint32_t ceiling;
PR_CEILING_LOG2(ceiling, capacity);
uint32_t ceiling = CeilingLog2(capacity);
ceiling -= PL_DHASH_BITS - table->hashShift;
(void) ChangeTable(table, ceiling);

View File

@ -17,12 +17,12 @@
#include "nsSegmentedBuffer.h"
#include "nsStreamUtils.h"
#include "nsCOMPtr.h"
#include "prbit.h"
#include "nsIInputStream.h"
#include "nsISeekableStream.h"
#include "prlog.h"
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
#include "mozilla/MathAlgorithms.h"
#if defined(PR_LOGGING)
//
@ -72,7 +72,7 @@ nsStorageStream::Init(uint32_t segmentSize, uint32_t maxSize,
return NS_ERROR_OUT_OF_MEMORY;
mSegmentSize = segmentSize;
mSegmentSizeLog2 = PR_FloorLog2(segmentSize);
mSegmentSizeLog2 = mozilla::FloorLog2(segmentSize);
// Segment size must be a power of two
if (mSegmentSize != ((uint32_t)1 << mSegmentSizeLog2))