Hi TinyCC devs,

Just found an issue when compiling with TCC, it seems that TCC is not
casting some int values correctly to float when dividing, I mean:

Following code fails on calculating correct float coordinates:

// sourceRec.x, sourceRec.y are floats
// texture.width, texture.height are int
rlTexCoord2f(sourceRec.x/texture.width, sourceRec.y/texture.height);

Same code works perfectly with MinGW, GCC, MSVC, Clang...

Also tried:

rlTexCoord2f(sourceRec.x/(float)texture.width,
sourceRec.y/(float)texture.height);

Instead I had to do:

float width = (float)texture.width;
float height = (float)texture.height;

rlTexCoord2f(sourceRec.x/width, sourceRec.y/height);

More info about this issue: https://github.com/raysan5/raylib/issues/553

By the way, thank you very much for this amazing light-weight super-fast
compiler! It's the perfect companion for my videogames library: raylib.

Regards,

Ray
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to