We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c1e5f2 commit 817adc2Copy full SHA for 817adc2
libvisual/libvisual/lv_color.c
@@ -270,15 +270,18 @@ uint32_t visual_color_to_uint32 (VisColor *color)
270
271
uint16_t visual_color_to_uint16 (VisColor *color)
272
{
273
- _color16 colors;
+ union {
274
+ _color16 channels;
275
+ uint16_t raw;
276
+ } colors;
277
278
visual_log_return_val_if_fail (color != NULL, 0);
279
- colors.r = color->r >> 2;
- colors.g = color->g >> 3;
- colors.b = color->b >> 2;
280
+ colors.channels.r = color->r >> 2;
281
+ colors.channels.g = color->g >> 3;
282
+ colors.channels.b = color->b >> 2;
283
- return *((uint16_t *) &colors);
284
+ return colors.raw;
285
}
286
287
VisColor *visual_color_black ()
0 commit comments