[AD] compare ALLEGRO_COLOR with memcmp |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: [AD] compare ALLEGRO_COLOR with memcmp
- From: Jon Rafkind <workmin@xxxxxxxxxx>
- Date: Mon, 06 Jun 2011 18:02:19 -0600
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)