diff options
author | Mattias Andrée <maandree@kth.se> | 2023-01-28 09:19:05 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-01-28 09:31:28 +0100 |
commit | 575e3ad31dd8ccf2afdd5c8a8d2dbf8d57241c5d (patch) | |
tree | 45b154e54eb7caa0300e5176237cb84257da138e /libglitter_split_uint64_raster.c | |
parent | libglitter.7: add application usage section (diff) | |
download | libglitter-1.0.tar.gz libglitter-1.0.tar.bz2 libglitter-1.0.tar.xz |
Fix warnings, add restrict, and add function attributes1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libglitter_split_uint64_raster.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libglitter_split_uint64_raster.c b/libglitter_split_uint64_raster.c index 75ec90b..bdcd427 100644 --- a/libglitter_split_uint64_raster.c +++ b/libglitter_split_uint64_raster.c @@ -38,15 +38,15 @@ libglitter_split_uint64_raster(uint16_t *rasters[3], uint16_t **alphap, uint64_t static void check(int with_alpha, int r, int g, int b, int a) { - int red_shift = r * sizeof(uint16_t) * 8; - int green_shift = g * sizeof(uint16_t) * 8; - int blue_shift = b * sizeof(uint16_t) * 8; - int alpha_shift = a * sizeof(uint16_t) * 8; - uint16_t full = ~(uint16_t)0; - uint16_t red = (uint16_t)~0 / (uint16_t)0xF * (uint16_t)0x5; - uint16_t green = (uint16_t)~0 / (uint16_t)0xF * (uint16_t)0x8; - uint16_t blue = (uint16_t)~0 / (uint16_t)0xF * (uint16_t)0xA; - uint16_t alpha = (uint16_t)~0 / (uint16_t)0xF * (uint16_t)0x9; + int red_shift = r * (int)sizeof(uint16_t) * 8; + int green_shift = g * (int)sizeof(uint16_t) * 8; + int blue_shift = b * (int)sizeof(uint16_t) * 8; + int alpha_shift = a * (int)sizeof(uint16_t) * 8; + uint16_t full = (uint16_t)~0U; + uint16_t red = (uint16_t)~0U / (uint16_t)0xF * (uint16_t)0x5; + uint16_t green = (uint16_t)~0U / (uint16_t)0xF * (uint16_t)0x8; + uint16_t blue = (uint16_t)~0U / (uint16_t)0xF * (uint16_t)0xA; + uint16_t alpha = (uint16_t)~0U / (uint16_t)0xF * (uint16_t)0x9; uint64_t red_mask = (uint64_t)red << red_shift; uint64_t green_mask = (uint64_t)green << green_shift; uint64_t blue_mask = (uint64_t)blue << blue_shift; |