Bug 795511: Removed usages of PR_BIT and PR_BITMASK from the tree; r=ehsan

This commit is contained in:
Abhishek Potnis 2012-10-20 07:31:43 +05:30
parent 0e85bee23b
commit ad50b9e765
11 changed files with 52 additions and 52 deletions

View File

@ -753,7 +753,7 @@ nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
} while (size < minSize);
}
else {
size = PR_BIT(PR_CeilingLog2(minSize));
size = 1u << PR_CeilingLog2(minSize);
}
bool needToInitialize = !mImpl;

View File

@ -170,13 +170,13 @@ class nsObjectLoadingContent : public nsImageLoadingContent
bool aForceLoad = false);
enum Capabilities {
eSupportImages = PR_BIT(0), // Images are supported (imgILoader)
eSupportPlugins = PR_BIT(1), // Plugins are supported (nsIPluginHost)
eSupportDocuments = PR_BIT(2), // Documents are supported
eSupportImages = 1u << 0, // Images are supported (imgILoader)
eSupportPlugins = 1u << 1, // Plugins are supported (nsIPluginHost)
eSupportDocuments = 1u << 2, // Documents are supported
// (nsIDocumentLoaderFactory)
// This flag always includes SVG
eSupportSVG = PR_BIT(3), // SVG is supported (image/svg+xml)
eSupportClassID = PR_BIT(4), // The classid attribute is supported
eSupportSVG = 1u << 3, // SVG is supported (image/svg+xml)
eSupportClassID = 1u << 4, // The classid attribute is supported
// Allows us to load a plugin if it matches a MIME type or file extension
// registered to a plugin without opening its specified URI first. Can
@ -184,7 +184,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
// types. Plugins without URIs may instantiate regardless.
// XXX(johns) this is our legacy behavior on <embed> tags, whereas object
// will always open a channel and check its MIME if a URI is present.
eAllowPluginSkipChannel = PR_BIT(5)
eAllowPluginSkipChannel = 1u << 5
};
/**
@ -221,17 +221,17 @@ class nsObjectLoadingContent : public nsImageLoadingContent
eParamNoChange = 0,
// Parameters that potentially affect the channel changed
// - mOriginalURI, mOriginalContentType
eParamChannelChanged = PR_BIT(0),
eParamChannelChanged = 1u << 0,
// Parameters that affect displayed content changed
// - mURI, mContentType, mType, mBaseURI
eParamStateChanged = PR_BIT(1),
eParamStateChanged = 1u << 1,
// The effective content type changed, independant of object type. This
// can happen when changing from Loading -> Final type, but doesn't
// necessarily happen when changing between object types. E.g., if a PDF
// handler was installed between the last load of this object and now, we
// might change from eType_Document -> eType_Plugin without changing
// ContentType
eParamContentTypeChanged = PR_BIT(2)
eParamContentTypeChanged = 1u << 2
};
/**

View File

@ -16,10 +16,10 @@ namespace dom {
typedef uint32_t ScreenOrientation;
static const ScreenOrientation eScreenOrientation_None = 0;
static const ScreenOrientation eScreenOrientation_PortraitPrimary = PR_BIT(0);
static const ScreenOrientation eScreenOrientation_PortraitSecondary = PR_BIT(1);
static const ScreenOrientation eScreenOrientation_LandscapePrimary = PR_BIT(2);
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = PR_BIT(3);
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
} // namespace dom
} // namespace mozilla

View File

@ -30,12 +30,12 @@ class Image;
#include "imgIDecoderObserver.h"
enum {
stateRequestStarted = PR_BIT(0),
stateHasSize = PR_BIT(1),
stateDecodeStopped = PR_BIT(3),
stateFrameStopped = PR_BIT(4),
stateRequestStopped = PR_BIT(5),
stateBlockingOnload = PR_BIT(6)
stateRequestStarted = 1u << 0,
stateHasSize = 1u << 1,
stateDecodeStopped = 1u << 3,
stateFrameStopped = 1u << 4,
stateRequestStopped = 1u << 5,
stateBlockingOnload = 1u << 6
};
class imgStatusTrackerObserver : public imgIDecoderObserver,

View File

@ -163,7 +163,7 @@ typedef uint16_t BCPixelSize;
// These are the max sizes that are stored. If they are exceeded, then the max is stored and
// the actual value is computed when needed.
#define MAX_BORDER_WIDTH nscoord(PR_BITMASK(sizeof(BCPixelSize) * 8))
#define MAX_BORDER_WIDTH nscoord((1u << (sizeof(BCPixelSize) * 8)) - 1)
static inline nscoord
BC_BORDER_TOP_HALF_COORD(int32_t p2t, uint16_t px) { return (px - px / 2) * p2t; }

View File

@ -875,7 +875,7 @@ static inline bool
IsLegalSchemeCharacter(const char aChar)
{
uint8_t mask = kLegalSchemeChars[aChar >> 3];
uint8_t bit = PR_BIT(aChar & 0x7);
uint8_t bit = 1u << (aChar & 0x7);
return bool((mask & bit) != 0);
}

View File

@ -130,7 +130,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 = PR_BIT(PR_CeilingLog2(newSize));
newSize = 1u << PR_CeilingLog2(newSize);
newCount = newSize / sizeof(mArray[0]);
}

View File

@ -256,7 +256,7 @@ bool nsVoidArray::GrowArrayBy(int32_t aGrowBy)
else
{
PR_CEILING_LOG2(newSize, newSize);
newCapacity = CAPACITYOF_IMPL(PR_BIT(newSize));
newCapacity = CAPACITYOF_IMPL(1u << newSize);
}
}
// frees old mImpl IF this succeeds

View File

@ -216,7 +216,7 @@ PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
PR_CEILING_LOG2(log2, capacity);
capacity = PR_BIT(log2);
capacity = 1u << log2;
if (capacity >= PL_DHASH_SIZE_LIMIT)
return false;
table->hashShift = PL_DHASH_BITS - log2;
@ -406,7 +406,7 @@ SearchTable(PLDHashTable *table, const void *key, PLDHashNumber keyHash,
/* Collision: double hash. */
sizeLog2 = PL_DHASH_BITS - table->hashShift;
hash2 = HASH2(keyHash, sizeLog2, hashShift);
sizeMask = PR_BITMASK(sizeLog2);
sizeMask = (1u << sizeLog2) - 1;
/* Save the first removed entry pointer so PL_DHASH_ADD can recycle it. */
firstRemoved = NULL;
@ -477,7 +477,7 @@ FindFreeEntry(PLDHashTable *table, PLDHashNumber keyHash)
/* Collision: double hash. */
sizeLog2 = PL_DHASH_BITS - table->hashShift;
hash2 = HASH2(keyHash, sizeLog2, hashShift);
sizeMask = PR_BITMASK(sizeLog2);
sizeMask = (1u << sizeLog2) - 1;
for (;;) {
NS_ASSERTION(!ENTRY_IS_REMOVED(entry),
@ -515,8 +515,8 @@ ChangeTable(PLDHashTable *table, int deltaLog2)
/* Look, but don't touch, until we succeed in getting new entry store. */
oldLog2 = PL_DHASH_BITS - table->hashShift;
newLog2 = oldLog2 + deltaLog2;
oldCapacity = PR_BIT(oldLog2);
newCapacity = PR_BIT(newLog2);
oldCapacity = 1u << oldLog2;
newCapacity = 1u << newLog2;
if (newCapacity >= PL_DHASH_SIZE_LIMIT)
return false;
entrySize = table->entrySize;
@ -828,7 +828,7 @@ PL_DHashTableDumpMeter(PLDHashTable *table, PLDHashEnumerator dump, FILE *fp)
hashShift = table->hashShift;
sizeLog2 = PL_DHASH_BITS - hashShift;
tableSize = PL_DHASH_TABLE_SIZE(table);
sizeMask = PR_BITMASK(sizeLog2);
sizeMask = (1u << sizeLog2) - 1;
chainCount = maxChainLen = 0;
hash2 = 0;
sqsum = 0;

View File

@ -19,10 +19,10 @@
* in sync.
*/
typedef enum {
url_All = 0 /**< %-escape every byte unconditionally */
, url_XAlphas = PR_BIT(0) /**< Normal escape - leave alphas intact, escape the rest */
, url_XPAlphas = PR_BIT(1) /**< As url_XAlphas, but convert spaces (0x20) to '+' and plus to %2B */
, url_Path = PR_BIT(2) /**< As url_XAlphas, but don't escape slash ('/') */
url_All = 0 /**< %-escape every byte unconditionally */
, url_XAlphas = 1u << 0 /**< Normal escape - leave alphas intact, escape the rest */
, url_XPAlphas = 1u << 1 /**< As url_XAlphas, but convert spaces (0x20) to '+' and plus to %2B */
, url_Path = 1u << 2 /**< As url_XAlphas, but don't escape slash ('/') */
} nsEscapeMask;
#ifdef __cplusplus
@ -73,27 +73,27 @@ nsEscapeHTML2(const PRUnichar *aSourceBuffer,
*/
enum EscapeMask {
/** url components **/
esc_Scheme = PR_BIT(0),
esc_Username = PR_BIT(1),
esc_Password = PR_BIT(2),
esc_Host = PR_BIT(3),
esc_Directory = PR_BIT(4),
esc_FileBaseName = PR_BIT(5),
esc_FileExtension = PR_BIT(6),
esc_Scheme = 1u << 0,
esc_Username = 1u << 1,
esc_Password = 1u << 2,
esc_Host = 1u << 3,
esc_Directory = 1u << 4,
esc_FileBaseName = 1u << 5,
esc_FileExtension = 1u << 6,
esc_FilePath = esc_Directory | esc_FileBaseName | esc_FileExtension,
esc_Param = PR_BIT(7),
esc_Query = PR_BIT(8),
esc_Ref = PR_BIT(9),
esc_Param = 1u << 7,
esc_Query = 1u << 8,
esc_Ref = 1u << 9,
/** special flags **/
esc_Minimal = esc_Scheme | esc_Username | esc_Password | esc_Host | esc_FilePath | esc_Param | esc_Query | esc_Ref,
esc_Forced = PR_BIT(10), /* forces escaping of existing escape sequences */
esc_OnlyASCII = PR_BIT(11), /* causes non-ascii octets to be skipped */
esc_OnlyNonASCII = PR_BIT(12), /* causes _graphic_ ascii octets (0x20-0x7E)
esc_Forced = 1u << 10, /* forces escaping of existing escape sequences */
esc_OnlyASCII = 1u << 11, /* causes non-ascii octets to be skipped */
esc_OnlyNonASCII = 1u << 12, /* causes _graphic_ ascii octets (0x20-0x7E)
* to be skipped when escaping. causes all
* ascii octets (<= 0x7F) to be skipped when unescaping */
esc_AlwaysCopy = PR_BIT(13), /* copy input to result buf even if escaping is unnecessary */
esc_Colon = PR_BIT(14), /* forces escape of colon */
esc_SkipControl = PR_BIT(15) /* skips C0 and DEL from unescaping */
esc_AlwaysCopy = 1u << 13, /* copy input to result buf even if escaping is unnecessary */
esc_Colon = 1u << 14, /* forces escape of colon */
esc_SkipControl = 1u << 15 /* skips C0 and DEL from unescaping */
};
/**

View File

@ -72,8 +72,8 @@ private:
nsTArray<nsTimerImpl*> mTimers;
#define DELAY_LINE_LENGTH_LOG2 5
#define DELAY_LINE_LENGTH_MASK PR_BITMASK(DELAY_LINE_LENGTH_LOG2)
#define DELAY_LINE_LENGTH PR_BIT(DELAY_LINE_LENGTH_LOG2)
#define DELAY_LINE_LENGTH_MASK ((1u << DELAY_LINE_LENGTH_LOG2) - 1)
#define DELAY_LINE_LENGTH (1u << DELAY_LINE_LENGTH_LOG2)
int32_t mDelayLine[DELAY_LINE_LENGTH]; // milliseconds
uint32_t mDelayLineCounter;