[AD] compare ALLEGRO_COLOR with memcmp

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I noticed there are two places in 5.1 that are comparing ALLEGRO_COLOR
using memcmp

$ grep -n memcmp *
bitmap.c:553:         if (memcmp(&pixel, &mask_color,
sizeof(ALLEGRO_COLOR)) == 0) {
optimized.c:196:        !memcmp(bc, &white, sizeof(ALLEGRO_COLOR))) {

Since ALLEGRO_COLOR's use floats internally is this dangerous? In my own
code I compare the values to some epsilon value

 if (fabs(c1.r - c2.r) < 0.0001 &&
     ...blue, green, alpha)




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/