mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1583970 - Cast sizeof to ptrdiff_t to avoid -16 / 4 = big
. r=tsmith
Differential Revision: https://phabricator.services.mozilla.com/D50149 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
87e26cbe4b
commit
d8be7e29ca
@ -172,8 +172,14 @@ class WebGLImageConverter {
|
||||
MOZ_ASSERT(
|
||||
mSrcStride % sizeof(SrcType) == 0 && mDstStride % sizeof(DstType) == 0,
|
||||
"Unsupported: texture stride is not a multiple of sizeof(type)");
|
||||
const ptrdiff_t srcStrideInElements = mSrcStride / sizeof(SrcType);
|
||||
const ptrdiff_t dstStrideInElements = mDstStride / sizeof(DstType);
|
||||
const ptrdiff_t srcStrideInElements =
|
||||
mSrcStride / static_cast<ptrdiff_t>(sizeof(SrcType));
|
||||
const ptrdiff_t dstStrideInElements =
|
||||
mDstStride / static_cast<ptrdiff_t>(sizeof(DstType));
|
||||
// Pop quiz: What's `ptrdiff_t(-16) / sizeof(int32_t)`?
|
||||
// Did you guess +4611686018427387900?
|
||||
MOZ_ASSERT(bool(srcStrideInElements < 0) == bool(mSrcStride < 0));
|
||||
MOZ_ASSERT(bool(dstStrideInElements < 0) == bool(mDstStride < 0));
|
||||
|
||||
const SrcType* srcRowStart = static_cast<const SrcType*>(mSrcStart);
|
||||
DstType* dstRowStart = static_cast<DstType*>(mDstStart);
|
||||
|
Loading…
Reference in New Issue
Block a user