From 0efc7d9c56f36d3d97e073dec5fac9c22b4ff8dc Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Fri, 19 Jun 2015 21:39:07 +0000 Subject: [PATCH] commented casts --- tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tty.c b/tty.c index 55c0de9..4bc8fc0 100644 --- a/tty.c +++ b/tty.c @@ -830,9 +830,8 @@ int tty_bg_colors_count = 16; unsigned int const *tty_fg_colors = tty_putty_colors; int tty_fg_colors_count = 16; -static inline int color_dist(unsigned int c1, unsigned int c2) -{ - +static inline int color_dist(unsigned int c1, unsigned int c2) { + /* using casts because c1 and c2 are unsigned */ return abs((int)((c1 >> 0) & 0xff) - (int)((c2 >> 0) & 0xff)) + 2 * abs((int)((c1 >> 8) & 0xff) - (int)((c2 >> 8) & 0xff)) + abs((int)((c1 >> 16) & 0xff) - (int)((c2 >> 16) & 0xff));