Re: [AD] optimization of create_video_bitmap() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> > The attached patch optimizes create_video_bitmap().
>
> Looks mostly good to me, except:
>
> +/* the product of these must fit in an int */
> +static int _create_video_bitmap_failed_w = 46340;
> +static int _create_video_bitmap_failed_h = 46340;
>
> Ah! Magic numbers... A #define would certainly be better here.
Actually, I think a const would be better =) But I guess a #define is good
to fit
in the Allegro 4 style.
> + _create_video_bitmap_failed_w =
> + _create_video_bitmap_failed_w * 2 + ((bitmap->w + 15) & ~15);
> + if (_create_video_bitmap_failed_w > 46340)
> + _create_video_bitmap_failed_w = 46340;
> + _create_video_bitmap_failed_h =
> + _create_video_bitmap_failed_h * 2 + bitmap->h;
> + if (_create_video_bitmap_failed_w > 46340)
> + _create_video_bitmap_failed_w = 46340;
>
> Ah! Copy-and-paste... Very useful but very dangerous as well ;-)
Looks like the magic numbers are defined above but don't get used here =)