util/format: nr_channels is always <= 4
While the nr_channels is defined with 3 bits, which allows up to 7 channels, actually the number of channels is less or equal to 4. This adds an assertion that helps static analyzers to avoid several false positives related with this. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32589>
This commit is contained in:
committed by
Marge Bot
parent
167f4a87c6
commit
5b42da1be8
@@ -1361,6 +1361,8 @@ static inline unsigned
|
||||
util_format_get_nr_components(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
assert(desc->nr_channels <= 4);
|
||||
|
||||
return desc->nr_channels;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user