plot icon indicating copy to clipboard operation
plot copied to clipboard

Make it compile nicely on 32 bit ARM platforms with GCC

Open azaparov opened this issue 6 years ago • 5 comments

Make it compile nicely on 32 bit ARM platform

azaparov avatar Jan 31 '19 23:01 azaparov

Thank you! Could you please elaborate a bit why is this necessary? In theory std::ptrdiff_t should be a pointer-sized signed type on any platform, so I expected it to be the same as long int also on 32-bit ARM.

Is this not true? Which compiler errors are you seeing?

fbbdev avatar Feb 01 '19 09:02 fbbdev

Yes it is 32 bit on arm. But all max/min functions in the code compare point coordinates with constants that look like “1L” (long int) so type matching breaks and compiler throws errors.

Perhaps using “L” suffix is not necessary? I doubt there is terminal in real life that will require long int precision :)

Regards.

On Feb 1, 2019, at 4:28 AM, Fabio Massaioli [email protected] wrote:

Thank you! Could you please elaborate a bit why is this necessary? In theory std::ptrdiff_t should be a pointer-sized signed type on any platform, so I expected it to be the same as long int also on 32-bit ARM.

Is this not true? Which compiler errors are you seeing?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

azaparov avatar Feb 01 '19 13:02 azaparov

Perhaps cleaner fix will be to explicitly cast all constants to point coordinate type. I did not go this route with time constraints I had.

On Feb 1, 2019, at 4:28 AM, Fabio Massaioli [email protected] wrote:

Thank you! Could you please elaborate a bit why is this necessary? In theory std::ptrdiff_t should be a pointer-sized signed type on any platform, so I expected it to be the same as long int also on 32-bit ARM.

Is this not true? Which compiler errors are you seeing?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

azaparov avatar Feb 01 '19 14:02 azaparov

Oh I see... Ironically I introduced all those L prefixes precisely to fix type matching :smile:

Yeah the right solution should be explicit casting like Coord(1). I can take some time to make the change myself if you don't have time. Or maybe I could improve min/max templates and make this unnecessary. Let's see.

I won't merge right now, but I'm keeping this PR open while I have a look at the code

fbbdev avatar Feb 01 '19 14:02 fbbdev

Sure thing :) Cool library btw!

On Feb 1, 2019, at 9:23 AM, Fabio Massaioli [email protected] wrote:

Oh I see... Ironically I introduced all those L prefixes precisely to fix type matching 😄

Yeah the right solution should be explicit casting like Coord(1). I can take some time to make the change myself if you don't have time. Or maybe I could improve min/max templates and make this unnecessary. Let's see.

I won't merge right now, but I'm keeping this PR open while I have a look at the code

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

azaparov avatar Feb 01 '19 14:02 azaparov