Skip to content

Commit

Permalink
Fixed conformance warnings found with Intel C++ compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jun 6, 2018
1 parent 5ff24af commit b2bb7aa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
23 changes: 14 additions & 9 deletions Audio/WAVFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@

using namespace DirectX;

#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */

namespace
{

//---------------------------------------------------------------------------------
// .WAV files
//---------------------------------------------------------------------------------
const uint32_t FOURCC_RIFF_TAG = 'FFIR';
const uint32_t FOURCC_FORMAT_TAG = ' tmf';
const uint32_t FOURCC_DATA_TAG = 'atad';
const uint32_t FOURCC_WAVE_FILE_TAG = 'EVAW';
const uint32_t FOURCC_XWMA_FILE_TAG = 'AMWX';
const uint32_t FOURCC_DLS_SAMPLE = 'pmsw';
const uint32_t FOURCC_MIDI_SAMPLE = 'lpms';
const uint32_t FOURCC_XWMA_DPDS = 'sdpd';
const uint32_t FOURCC_XMA_SEEK = 'kees';
const uint32_t FOURCC_RIFF_TAG = MAKEFOURCC('R', 'I', 'F', 'F');
const uint32_t FOURCC_FORMAT_TAG = MAKEFOURCC('f', 'm', 't', ' ');
const uint32_t FOURCC_DATA_TAG = MAKEFOURCC('d', 'a', 't', 'a');
const uint32_t FOURCC_WAVE_FILE_TAG = MAKEFOURCC('W', 'A', 'V', 'E');
const uint32_t FOURCC_XWMA_FILE_TAG = MAKEFOURCC('X', 'W', 'M', 'A');
const uint32_t FOURCC_DLS_SAMPLE = MAKEFOURCC('w', 's', 'm', 'p');
const uint32_t FOURCC_MIDI_SAMPLE = MAKEFOURCC('s', 'm', 'p', 'l');
const uint32_t FOURCC_XWMA_DPDS = MAKEFOURCC('d', 'p', 'd', 's');
const uint32_t FOURCC_XMA_SEEK = MAKEFOURCC('s', 'e', 'e', 'k');

#pragma pack(push,1)
struct RIFFChunk
Expand Down
11 changes: 8 additions & 3 deletions Audio/WaveBankReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include <apu.h>
#endif

#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */

namespace
{
Expand Down Expand Up @@ -59,8 +64,8 @@ namespace

struct HEADER
{
static const uint32_t SIGNATURE = 'DNBW';
static const uint32_t BE_SIGNATURE = 'WBND';
static const uint32_t SIGNATURE = MAKEFOURCC('W', 'B', 'N', 'D');
static const uint32_t BE_SIGNATURE = MAKEFOURCC('D', 'N', 'B', 'W');
static const uint32_t VERSION = 44;

enum SEGIDX
Expand Down Expand Up @@ -347,7 +352,7 @@ namespace
uint32_t partial = length % data.CompactFormat.BlockAlign();
if (partial)
{
if (partial >= (7 * data.CompactFormat.nChannels))
if (partial >= (7u * data.CompactFormat.nChannels))
duration += (partial * 2 / data.CompactFormat.nChannels - 12);
}
return duration;
Expand Down
4 changes: 2 additions & 2 deletions Src/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ void DirectX::ComputeTeapot(VertexCollection& vertices, IndexCollection& indices
XMVECTOR scaleNegateZ = scaleVector * g_XMNegateZ;
XMVECTOR scaleNegateXZ = scaleVector * g_XMNegateX * g_XMNegateZ;

for (int i = 0; i < sizeof(TeapotPatches) / sizeof(TeapotPatches[0]); i++)
for (size_t i = 0; i < _countof(TeapotPatches); i++)
{
TeapotPatch const& patch = TeapotPatches[i];

Expand All @@ -1179,4 +1179,4 @@ void DirectX::ComputeTeapot(VertexCollection& vertices, IndexCollection& indices
// Built RH above
if (!rhcoords)
ReverseWinding(indices, vertices);
}
}
10 changes: 6 additions & 4 deletions Src/SpriteBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ std::vector<short> SpriteBatch::Impl::DeviceResources::CreateIndexValues()

indices.reserve(MaxBatchSize * IndicesPerSprite);

for (short i = 0; i < MaxBatchSize * VerticesPerSprite; i += VerticesPerSprite)
for (size_t j = 0; j < MaxBatchSize * VerticesPerSprite; j += VerticesPerSprite)
{
short i = static_cast<short>(j);

indices.push_back(i);
indices.push_back(i + 1);
indices.push_back(i + 2);
Expand Down Expand Up @@ -913,10 +915,10 @@ void XM_CALLCONV SpriteBatch::Impl::RenderSprite(SpriteInfo const* sprite, Verte
static_assert(SpriteEffects_FlipHorizontally == 1 &&
SpriteEffects_FlipVertically == 2, "If you change these enum values, the mirroring implementation must be updated to match");

int mirrorBits = flags & 3;
const unsigned int mirrorBits = flags & 3;

// Generate the four output vertices.
for (int i = 0; i < VerticesPerSprite; i++)
for (size_t i = 0; i < VerticesPerSprite; i++)
{
// Calculate position.
XMVECTOR cornerOffset = (cornerOffsets[i] - origin) * destinationSize;
Expand All @@ -937,7 +939,7 @@ void XM_CALLCONV SpriteBatch::Impl::RenderSprite(SpriteInfo const* sprite, Verte
XMStoreFloat4(&vertices[i].color, color);

// Compute and write the texture coordinate.
XMVECTOR textureCoordinate = XMVectorMultiplyAdd(cornerOffsets[i ^ mirrorBits], sourceSize, source);
XMVECTOR textureCoordinate = XMVectorMultiplyAdd(cornerOffsets[static_cast<unsigned int>(i) ^ mirrorBits], sourceSize, source);

XMStoreFloat2(&vertices[i].textureCoordinate, textureCoordinate);
}
Expand Down
7 changes: 7 additions & 0 deletions Src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
// C4986 exception specification does not match previous declaration
// C5043 exception specification does not match previous declaration

#ifdef __INTEL_COMPILER
#pragma warning(disable : 161 2960 3280)
// warning #161: unrecognized #pragma
// message #2960: allocation may not satisfy the type's alignment; consider using <aligned_new> header
// message #3280: declaration hides member
#endif

#pragma warning(push)
#pragma warning(disable : 4005)
#define WIN32_LEAN_AND_MEAN
Expand Down

0 comments on commit b2bb7aa

Please sign in to comment.