diff options
author | Erik Faye-Lund <[email protected]> | 2019-08-13 13:02:24 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-08-15 20:23:53 +0200 |
commit | 18ab42644b134e3aecd8ea14df3d30eb9b6a80f4 (patch) | |
tree | 66c9ed55482bb1c03021fd8a73168485bbac1bdc /src/gallium/auxiliary | |
parent | 0091f62978b26e89e8c0581552b4b91667c658fd (diff) |
gallium/util: widen type before multiplication
This method returns size_t, but the multiplication multiplies two
integers, leading to overflow rather than type widening.
Noticed by compiling with MSVC, which emits a warning.
Signed-off-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index fe348aa55c8..eb8c2f6ae3f 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -870,7 +870,7 @@ static inline size_t util_format_get_stride(enum pipe_format format, unsigned width) { - return util_format_get_nblocksx(format, width) * util_format_get_blocksize(format); + return (size_t)util_format_get_nblocksx(format, width) * util_format_get_blocksize(format); } static inline size_t |