From 7d95a9d89a6322d18c0892bed751b9c29253758c Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 8 Jul 2019 11:57:07 -0700 Subject: [PATCH] Code review feedback --- DirectXTex/d3dx12.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/DirectXTex/d3dx12.h b/DirectXTex/d3dx12.h index 06171d8..45f6b4e 100644 --- a/DirectXTex/d3dx12.h +++ b/DirectXTex/d3dx12.h @@ -1582,12 +1582,12 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += SIZE_T(offsetInDescriptors) * SIZE_T(descriptorIncrementSize); + ptr = SIZE_T(INT64(ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize)); return *this; } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) { - ptr += SIZE_T(offsetScaledByIncrementSize); + ptr = SIZE_T(INT64(ptr) + INT64(offsetScaledByIncrementSize)); return *this; } bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) const @@ -1616,12 +1616,12 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { - handle.ptr = base.ptr + SIZE_T(offsetScaledByIncrementSize); + handle.ptr = SIZE_T(INT64(base.ptr) + INT64(offsetScaledByIncrementSize)); } static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = base.ptr + SIZE_T(offsetInDescriptors) * SIZE_T(descriptorIncrementSize); + handle.ptr = SIZE_T(INT64(base.ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize)); } }; @@ -1643,12 +1643,12 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); + ptr = UINT64(INT64(ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize)); return *this; } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) { - ptr += UINT64(offsetScaledByIncrementSize); + ptr = UINT64(INT64(ptr) + INT64(offsetScaledByIncrementSize)); return *this; } inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) const @@ -1677,12 +1677,12 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { - handle.ptr = base.ptr + UINT64(offsetScaledByIncrementSize); + handle.ptr = UINT64(INT64(base.ptr) + INT64(offsetScaledByIncrementSize)); } static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = base.ptr + UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); + handle.ptr = UINT64(INT64(base.ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize)); } };