mirror of
https://gitlab.freedesktop.org/emersion/libdisplay-info.git
synced 2024-11-16 19:48:30 +01:00
edid: fix uint16_t conversion warning
../../git/weston/subprojects/display-info/edid.c: In function ‘decode_chromaticity_coord’: ../../git/weston/subprojects/display-info/edid.c:250:8: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion] 250 | raw = (uint16_t) (hi << 2) | lo; | ^ Apparently the cast applies to (hi << 2), then bitwise-or implicitly promotes to signed int, and that gets assigned to uint16_t raw. At least gcc 10.2.1 from Debian seems to think so. Fix it by forcing the cast on the complete result. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
619fc30c7b
commit
56be915e27
1 changed files with 1 additions and 1 deletions
2
edid.c
2
edid.c
|
@ -247,7 +247,7 @@ decode_chromaticity_coord(uint8_t hi, uint8_t lo)
|
|||
{
|
||||
uint16_t raw; /* only 10 bits are used */
|
||||
|
||||
raw = (uint16_t) (hi << 2) | lo;
|
||||
raw = (uint16_t) ((hi << 2) | lo);
|
||||
return (float) raw / 1024;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue