diff --git a/include/Nazara/Core/SparsePtr.hpp b/include/Nazara/Core/SparsePtr.hpp index 94c3f249f..74a64425d 100644 --- a/include/Nazara/Core/SparsePtr.hpp +++ b/include/Nazara/Core/SparsePtr.hpp @@ -21,34 +21,34 @@ class NzSparsePtr NzSparsePtr(); NzSparsePtr(T* ptr); - NzSparsePtr(VoidPtr ptr, unsigned int stride); + NzSparsePtr(VoidPtr ptr, int stride); template NzSparsePtr(const NzSparsePtr& ptr); NzSparsePtr(const NzSparsePtr& ptr) = default; ~NzSparsePtr() = default; VoidPtr GetPtr() const; - unsigned int GetStride() const; + int GetStride() const; void Reset(); void Reset(T* ptr); - void Reset(VoidPtr ptr, unsigned int stride); + void Reset(VoidPtr ptr, int stride); void Reset(const NzSparsePtr& ptr); template void Reset(const NzSparsePtr& ptr); void SetPtr(VoidPtr ptr); - void SetStride(unsigned int stride); + void SetStride(int stride); operator bool() const; operator T*() const; T& operator*() const; T& operator->() const; - T& operator[](unsigned int index) const; + T& operator[](int index) const; - NzSparsePtr operator+(unsigned int count) const; - NzSparsePtr operator-(unsigned int count) const; + NzSparsePtr operator+(int count) const; + NzSparsePtr operator-(int count) const; - NzSparsePtr& operator+=(unsigned int count); - NzSparsePtr& operator-=(unsigned int count); + NzSparsePtr& operator+=(int count); + NzSparsePtr& operator-=(int count); NzSparsePtr& operator++(); NzSparsePtr operator++(int); @@ -67,7 +67,7 @@ class NzSparsePtr private: BytePtr m_ptr; - unsigned int m_stride; + int m_stride; }; #include diff --git a/include/Nazara/Core/SparsePtr.inl b/include/Nazara/Core/SparsePtr.inl index ca0d7e328..661c9292a 100644 --- a/include/Nazara/Core/SparsePtr.inl +++ b/include/Nazara/Core/SparsePtr.inl @@ -17,7 +17,7 @@ NzSparsePtr::NzSparsePtr(T* ptr) } template -NzSparsePtr::NzSparsePtr(VoidPtr ptr, unsigned int stride) +NzSparsePtr::NzSparsePtr(VoidPtr ptr, int stride) { Reset(ptr, stride); } @@ -36,7 +36,7 @@ typename NzSparsePtr::VoidPtr NzSparsePtr::GetPtr() const } template -unsigned int NzSparsePtr::GetStride() const +int NzSparsePtr::GetStride() const { return m_stride; } @@ -56,7 +56,7 @@ void NzSparsePtr::Reset(T* ptr) } template -void NzSparsePtr::Reset(VoidPtr ptr, unsigned int stride) +void NzSparsePtr::Reset(VoidPtr ptr, int stride) { SetPtr(ptr); SetStride(stride); @@ -86,7 +86,7 @@ void NzSparsePtr::SetPtr(VoidPtr ptr) } template -void NzSparsePtr::SetStride(unsigned int stride) +void NzSparsePtr::SetStride(int stride) { m_stride = stride; } @@ -116,25 +116,25 @@ T& NzSparsePtr::operator->() const } template -T& NzSparsePtr::operator[](unsigned int index) const +T& NzSparsePtr::operator[](int index) const { return *reinterpret_cast(m_ptr + index*m_stride); } template -NzSparsePtr NzSparsePtr::operator+(unsigned int count) const +NzSparsePtr NzSparsePtr::operator+(int count) const { return NzSparsePtr(m_ptr + count*m_stride, m_stride); } template -NzSparsePtr NzSparsePtr::operator-(unsigned int count) const +NzSparsePtr NzSparsePtr::operator-(int count) const { return NzSparsePtr(m_ptr - count*m_stride, m_stride); } template -NzSparsePtr& NzSparsePtr::operator+=(unsigned int count) +NzSparsePtr& NzSparsePtr::operator+=(int count) { m_ptr += count*m_stride; @@ -142,7 +142,7 @@ NzSparsePtr& NzSparsePtr::operator+=(unsigned int count) } template -NzSparsePtr& NzSparsePtr::operator-=(unsigned int count) +NzSparsePtr& NzSparsePtr::operator-=(int count) { m_ptr -= count*m_stride;