Hey, original contributor of intsafe.h here.  Thank you for fixing this
bug, which was introduced in 2019 by someone else.

I agree with Martin: let's keep the header short and readable, avoid
unneeded ifdefs, define functions in a way that they are obviously correct
on all systems, and not define the same thing twice.

--David

On Fri, Oct 18, 2024, 3:55 AM Martin Storsjö <mar...@martin.st> wrote:

> On Fri, 18 Oct 2024, Jacek Caban wrote:
>
> >
> > Don't assume that pointer-sized types are long long.
> >
> > Fixes: 0cf06d5cb6968ad71d36a193eeb04f3266bb3aaa
> > Signed-off-by: Jacek Caban <ja...@codeweavers.com>
> > ---
> > mingw-w64-headers/include/intsafe.h | 160 +++++++++++++++-------------
> > 1 file changed, 85 insertions(+), 75 deletions(-)
>
> Hmm, this patch is a bit hard to review, as a lot of the patch is just
> restructuring the existing definitions.
>
> Also, I have a hard time figuring out the reason for doing things this
> way. E.g. this:
>
> +#ifdef _WIN64
> +#define ULongPtrAdd ULongLongAdd
> +#define DWordPtrAdd ULongLongAdd
> +#define IntPtrAdd LongLongAdd
> +#else
>   __MINGW_INTSAFE_API __MINGW_INTSAFE_MATH(ULongPtrAdd, ULONG_PTR, add)
>   __MINGW_INTSAFE_API __MINGW_INTSAFE_MATH(DWordPtrAdd, DWORD_PTR, add)
>   __MINGW_INTSAFE_API __MINGW_INTSAFE_MATH(IntPtrAdd, INT_PTR, add)
> +#endif
> -#define ULongPtrAdd ULongLongAdd
> -#define DWordPtrAdd ULongLongAdd
> -#define IntPtrAdd LongLongAdd
>
> Wouldn't the preexisting declarations, using __MINGW_INTSAFE_MATH() with
> ULONG_PTR, DWORD_PTR and INT_PTR etc, be correct for both 32 and 64 bit
> environments, if we'd just remove the incorrect defines at the end?
>
> // Martin
>
>
>
>
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to