Fix warnings in MSVC
This commit is contained in:
parent
56342c1f0f
commit
0e15fa0a01
|
@ -276,7 +276,7 @@ class Map {
|
||||||
uint32* newBuckets = static_cast<uint32*>(mAllocator.allocate(capacity * sizeof(uint32)));
|
uint32* newBuckets = static_cast<uint32*>(mAllocator.allocate(capacity * sizeof(uint32)));
|
||||||
|
|
||||||
// Allocate memory for the entries
|
// Allocate memory for the entries
|
||||||
const uint32 nbAllocatedEntries = capacity * DEFAULT_LOAD_FACTOR;
|
const uint32 nbAllocatedEntries = static_cast<uint32>(capacity * DEFAULT_LOAD_FACTOR);
|
||||||
assert(nbAllocatedEntries > 0);
|
assert(nbAllocatedEntries > 0);
|
||||||
Pair<K, V>* newEntries = static_cast<Pair<K, V>*>(mAllocator.allocate(nbAllocatedEntries * sizeof(Pair<K, V>)));
|
Pair<K, V>* newEntries = static_cast<Pair<K, V>*>(mAllocator.allocate(nbAllocatedEntries * sizeof(Pair<K, V>)));
|
||||||
uint32* newNextEntries = static_cast<uint32*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint32)));
|
uint32* newNextEntries = static_cast<uint32*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint32)));
|
||||||
|
@ -352,7 +352,7 @@ class Map {
|
||||||
/// Returns true if the item has been inserted and false otherwise.
|
/// Returns true if the item has been inserted and false otherwise.
|
||||||
bool add(const Pair<K,V>& keyValue, bool insertIfAlreadyPresent = false) {
|
bool add(const Pair<K,V>& keyValue, bool insertIfAlreadyPresent = false) {
|
||||||
|
|
||||||
uint32 bucket;
|
uint32 bucket = INVALID_INDEX;
|
||||||
|
|
||||||
// Compute the hash code of the value
|
// Compute the hash code of the value
|
||||||
const size_t hashCode = Hash()(keyValue.first);
|
const size_t hashCode = Hash()(keyValue.first);
|
||||||
|
@ -389,7 +389,7 @@ class Map {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t entryIndex;
|
uint32 entryIndex;
|
||||||
|
|
||||||
// If there are no more free entries to use
|
// If there are no more free entries to use
|
||||||
if (mFreeIndex == INVALID_INDEX) {
|
if (mFreeIndex == INVALID_INDEX) {
|
||||||
|
@ -411,6 +411,7 @@ class Map {
|
||||||
|
|
||||||
mNbEntries++;
|
mNbEntries++;
|
||||||
|
|
||||||
|
assert(bucket != INVALID_INDEX);
|
||||||
mNextEntries[entryIndex] = mBuckets[bucket];
|
mNextEntries[entryIndex] = mBuckets[bucket];
|
||||||
new (mEntries + entryIndex) Pair<K, V>(keyValue);
|
new (mEntries + entryIndex) Pair<K, V>(keyValue);
|
||||||
mBuckets[bucket] = entryIndex;
|
mBuckets[bucket] = entryIndex;
|
||||||
|
@ -543,7 +544,7 @@ class Map {
|
||||||
|
|
||||||
const size_t hashCode = Hash()(key);
|
const size_t hashCode = Hash()(key);
|
||||||
const size_t divider = mHashSize - 1;
|
const size_t divider = mHashSize - 1;
|
||||||
bucket = hashCode & divider;
|
bucket = static_cast<uint32>(hashCode & divider);
|
||||||
auto keyEqual = KeyEqual();
|
auto keyEqual = KeyEqual();
|
||||||
|
|
||||||
for (uint32 i = mBuckets[bucket]; i != INVALID_INDEX; i = mNextEntries[i]) {
|
for (uint32 i = mBuckets[bucket]; i != INVALID_INDEX; i = mNextEntries[i]) {
|
||||||
|
|
|
@ -275,7 +275,7 @@ class Set {
|
||||||
uint32* newBuckets = static_cast<uint32*>(mAllocator.allocate(capacity * sizeof(uint32)));
|
uint32* newBuckets = static_cast<uint32*>(mAllocator.allocate(capacity * sizeof(uint32)));
|
||||||
|
|
||||||
// Allocate memory for the entries
|
// Allocate memory for the entries
|
||||||
const uint32 nbAllocatedEntries = capacity * DEFAULT_LOAD_FACTOR;
|
const uint32 nbAllocatedEntries = static_cast<uint32>(capacity * DEFAULT_LOAD_FACTOR);
|
||||||
assert(nbAllocatedEntries > 0);
|
assert(nbAllocatedEntries > 0);
|
||||||
V* newEntries = static_cast<V*>(mAllocator.allocate(nbAllocatedEntries * sizeof(V)));
|
V* newEntries = static_cast<V*>(mAllocator.allocate(nbAllocatedEntries * sizeof(V)));
|
||||||
uint32* newNextEntries = static_cast<uint32*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint32)));
|
uint32* newNextEntries = static_cast<uint32*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint32)));
|
||||||
|
@ -375,7 +375,7 @@ class Set {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t entryIndex;
|
uint32 entryIndex;
|
||||||
|
|
||||||
// If there are no more free entries to use
|
// If there are no more free entries to use
|
||||||
if (mFreeIndex == INVALID_INDEX) {
|
if (mFreeIndex == INVALID_INDEX) {
|
||||||
|
|
|
@ -399,10 +399,10 @@ RP3D_FORCE_INLINE void OverlappingPairs::setNeedToTestOverlap(uint64 pairId, boo
|
||||||
|
|
||||||
auto it = mMapConvexPairIdToPairIndex.find(pairId);
|
auto it = mMapConvexPairIdToPairIndex.find(pairId);
|
||||||
if (it != mMapConvexPairIdToPairIndex.end()) {
|
if (it != mMapConvexPairIdToPairIndex.end()) {
|
||||||
mConvexPairs[it->second].needToTestOverlap = needToTestOverlap;
|
mConvexPairs[static_cast<uint32>(it->second)].needToTestOverlap = needToTestOverlap;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mConcavePairs[mMapConcavePairIdToPairIndex[pairId]].needToTestOverlap = needToTestOverlap;
|
mConcavePairs[static_cast<uint32>(mMapConcavePairIdToPairIndex[pairId])].needToTestOverlap = needToTestOverlap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,11 +411,11 @@ RP3D_FORCE_INLINE OverlappingPairs::OverlappingPair* OverlappingPairs::getOverla
|
||||||
|
|
||||||
auto it = mMapConvexPairIdToPairIndex.find(pairId);
|
auto it = mMapConvexPairIdToPairIndex.find(pairId);
|
||||||
if (it != mMapConvexPairIdToPairIndex.end()) {
|
if (it != mMapConvexPairIdToPairIndex.end()) {
|
||||||
return &(mConvexPairs[it->second]);
|
return &(mConvexPairs[static_cast<uint32>(it->second)]);
|
||||||
}
|
}
|
||||||
it = mMapConcavePairIdToPairIndex.find(pairId);
|
it = mMapConcavePairIdToPairIndex.find(pairId);
|
||||||
if (it != mMapConcavePairIdToPairIndex.end()) {
|
if (it != mMapConcavePairIdToPairIndex.end()) {
|
||||||
return &(mConcavePairs[it->second]);
|
return &(mConcavePairs[static_cast<uint32>(it->second)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -262,8 +262,8 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide
|
||||||
switch(mUpAxis) {
|
switch(mUpAxis) {
|
||||||
case 0 : stepI = rayDirection.y > 0 ? 1 : (rayDirection.y < 0 ? -1 : 0);
|
case 0 : stepI = rayDirection.y > 0 ? 1 : (rayDirection.y < 0 ? -1 : 0);
|
||||||
stepJ = rayDirection.z > 0 ? 1 : (rayDirection.z < 0 ? -1 : 0);
|
stepJ = rayDirection.z > 0 ? 1 : (rayDirection.z < 0 ? -1 : 0);
|
||||||
nextI = stepI >= 0 ? i + 1 : i;
|
nextI = static_cast<decimal>(stepI >= 0 ? i + 1 : i);
|
||||||
nextJ = stepJ >= 0 ? j + 1 : j;
|
nextJ = static_cast<decimal>(stepJ >= 0 ? j + 1 : j);
|
||||||
sizeI = aabbSize.y / nbCellsI;
|
sizeI = aabbSize.y / nbCellsI;
|
||||||
sizeJ = aabbSize.z / nbCellsJ;
|
sizeJ = aabbSize.z / nbCellsJ;
|
||||||
tMaxI = ((nextI * sizeI) - outHitGridPoint.y) / rayDirection.y;
|
tMaxI = ((nextI * sizeI) - outHitGridPoint.y) / rayDirection.y;
|
||||||
|
@ -273,8 +273,8 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide
|
||||||
break;
|
break;
|
||||||
case 1 : stepI = rayDirection.x > 0 ? 1 : (rayDirection.x < 0 ? -1 : 0);
|
case 1 : stepI = rayDirection.x > 0 ? 1 : (rayDirection.x < 0 ? -1 : 0);
|
||||||
stepJ = rayDirection.z > 0 ? 1 : (rayDirection.z < 0 ? -1 : 0);
|
stepJ = rayDirection.z > 0 ? 1 : (rayDirection.z < 0 ? -1 : 0);
|
||||||
nextI = stepI >= 0 ? i + 1 : i;
|
nextI = static_cast<decimal>(stepI >= 0 ? i + 1 : i);
|
||||||
nextJ = stepJ >= 0 ? j + 1 : j;
|
nextJ = static_cast<decimal>(stepJ >= 0 ? j + 1 : j);
|
||||||
sizeI = aabbSize.x / nbCellsI;
|
sizeI = aabbSize.x / nbCellsI;
|
||||||
sizeJ = aabbSize.z / nbCellsJ;
|
sizeJ = aabbSize.z / nbCellsJ;
|
||||||
tMaxI = ((nextI * sizeI) - outHitGridPoint.x) / rayDirection.x;
|
tMaxI = ((nextI * sizeI) - outHitGridPoint.x) / rayDirection.x;
|
||||||
|
@ -284,8 +284,8 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide
|
||||||
break;
|
break;
|
||||||
case 2 : stepI = rayDirection.x > 0 ? 1 : (rayDirection.x < 0 ? -1 : 0);
|
case 2 : stepI = rayDirection.x > 0 ? 1 : (rayDirection.x < 0 ? -1 : 0);
|
||||||
stepJ = rayDirection.y > 0 ? 1 : (rayDirection.y < 0 ? -1 : 0);
|
stepJ = rayDirection.y > 0 ? 1 : (rayDirection.y < 0 ? -1 : 0);
|
||||||
nextI = stepI >= 0 ? i + 1 : i;
|
nextI = static_cast<decimal>(stepI >= 0 ? i + 1 : i);
|
||||||
nextJ = stepJ >= 0 ? j + 1 : j;
|
nextJ = static_cast<decimal>(stepJ >= 0 ? j + 1 : j);
|
||||||
sizeI = aabbSize.x / nbCellsI;
|
sizeI = aabbSize.x / nbCellsI;
|
||||||
sizeJ = aabbSize.y / nbCellsJ;
|
sizeJ = aabbSize.y / nbCellsJ;
|
||||||
tMaxI = ((nextI * sizeI) - outHitGridPoint.x) / rayDirection.x;
|
tMaxI = ((nextI * sizeI) - outHitGridPoint.x) / rayDirection.x;
|
||||||
|
|
|
@ -151,7 +151,7 @@ void* PoolAllocator::allocate(size_t size) {
|
||||||
newBlock->memoryUnits = static_cast<MemoryUnit*>(mBaseAllocator.allocate(BLOCK_SIZE));
|
newBlock->memoryUnits = static_cast<MemoryUnit*>(mBaseAllocator.allocate(BLOCK_SIZE));
|
||||||
assert(newBlock->memoryUnits != nullptr);
|
assert(newBlock->memoryUnits != nullptr);
|
||||||
size_t unitSize = mUnitSizes[indexHeap];
|
size_t unitSize = mUnitSizes[indexHeap];
|
||||||
uint nbUnits = BLOCK_SIZE / unitSize;
|
size_t nbUnits = BLOCK_SIZE / unitSize;
|
||||||
assert(nbUnits * unitSize <= BLOCK_SIZE);
|
assert(nbUnits * unitSize <= BLOCK_SIZE);
|
||||||
void* memoryUnitsStart = static_cast<void*>(newBlock->memoryUnits);
|
void* memoryUnitsStart = static_cast<void*>(newBlock->memoryUnits);
|
||||||
char* memoryUnitsStartChar = static_cast<char*>(memoryUnitsStart);
|
char* memoryUnitsStartChar = static_cast<char*>(memoryUnitsStart);
|
||||||
|
|
|
@ -171,7 +171,7 @@ void DebugRenderer::drawCapsule(const Transform& transform, decimal radius, deci
|
||||||
|
|
||||||
Vector3 vertices[(NB_SECTORS_SPHERE + 1) * (NB_STACKS_SPHERE + 1) + (NB_SECTORS_SPHERE + 1)];
|
Vector3 vertices[(NB_SECTORS_SPHERE + 1) * (NB_STACKS_SPHERE + 1) + (NB_SECTORS_SPHERE + 1)];
|
||||||
|
|
||||||
const decimal halfHeight = 0.5 * height;
|
const decimal halfHeight = decimal(0.5) * height;
|
||||||
|
|
||||||
// Use an even number of stacks
|
// Use an even number of stacks
|
||||||
const uint32 nbStacks = NB_STACKS_SPHERE % 2 == 0 ? NB_STACKS_SPHERE : NB_STACKS_SPHERE - 1;
|
const uint32 nbStacks = NB_STACKS_SPHERE % 2 == 0 ? NB_STACKS_SPHERE : NB_STACKS_SPHERE - 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user