megamarc/Tilengine

float2fix's argument lacks parenthesis

Opened this issue · 0 comments

Hello. I'm currently in search of works done around affine transformations to have reference results to build my own idea and I found your library like this. So far, I like to tinker around it, so I'll see later if I'm going to stick with it for some prototypes.

I just found an issue with float2fix: its implementation doesn't wrap properly its argument in the macro's expansion

#define float2fix(f)	(fix_t)(f*(1 << FIXED_BITS))

should be instead

#define float2fix(f)	(fix_t)((f)*(1 << FIXED_BITS))

Else it breaks once the the user code involves operations other than just value/variable.
(I didn't think a PR for such a microscopic change felt relevant)

Have a nice day