Re: [Mingw-w64-public] contributions

2021-09-05 Thread JonY via Mingw-w64-public

On 9/5/21 12:58 PM, Glenn Burkhardt wrote:
I don't know if those functions are available from Cygwin.  But they are 
not in MinGW-w64.  I don't care how they get to MinGW-w64, it would be 
convenient to have them.


And why do you bring up Cygwin?  This is the MinGW-w64 mailing list, right?



Use Cygwin if you need symlink support, mingw-w64 isn't the place to 
introduce new API implementations.




OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] Fix exponent when formatting long double in hexadecimal.

2021-09-05 Thread Patrick Northon via Mingw-w64-public
Hi, here's a patch to fix another problem with formatting long doubles in 
hexadecimal. I found a failing case with a denormalized value:

printf("0x2.0p-16385l : %La\n", 0x2.0p-16385l);

Complete tests:

#include 
#include 
#include 

int main(int argc, char **argv)
{
puts(  " --- Long doubles ---\n");

char buf[100];
snprintf(buf, sizeof buf, "%La", 4.483595e-4949l);
puts(buf);
char *end;
long double v = strtold(buf, );
printf("%Le\n", v);

if(v != 4.483595e-4949l)
puts("Test failed for formatting 4.483595e-4949l.");
else
puts("Test succeeded for formatting 4.483595e-4949l.");

printf("8.0l :  %La\n", 8.0l);
printf("1.5l :  %La\n", 1.5l);
printf("0.5l :  %La\n", 0.5l);
printf("2.0l :  %La\n", 2.0l);
printf("1.0l :  %La\n", 1.0l);
printf("0.0l :  %La\n", 0.0l);
printf("-8.0l : %La\n", -8.0l);
printf("-1.5l : %La\n", -1.5l);
printf("-0.5l : %La\n", -0.5l);
printf("-2.0l : %La\n", -2.0l);
printf("-1.0l : %La\n", -1.0l);
printf("-0.0l : %La\n", -0.0l);
printf("423.2323l : %La\n", 423.2323l);
printf("-423.2323l :%La\n", -423.2323l);
printf("LDBL_MAX :  %La\n", LDBL_MAX);
printf("-LDBL_MAX : %La\n", -LDBL_MAX);
puts(  " [Denormalized]");
printf("4.4836e-4949l : %La\n", 4.4836e-4949l);
printf("-4.4836e-4949l :%La\n", -4.4836e-4949l);
printf("4.4836e-4949l (.5) :%.5La\n", 4.4836e-4949l);
printf("-4.4836e-4949l (.5) :   %.5La\n", -4.4836e-4949l);
printf("0x0.0030p+0l :  %La\n", 0x0.0030p+0l);
printf("0x0.0040p+0l :  %La\n", 0x0.0040p+0l);
printf("0x0.0040p+0l :  %40La\n", 0x0.0030p+0l);
printf("0x0.0040p+0l :  %#40La\n", 0x0.0040p+0l);
printf("0x0.0040p+0l :  %-40La\n", 0x0.0040p+0l);
printf("0x0.0040p+0l :  %#-40La\n", 0x0.0040p+0l);
printf("0x2.0p-16385l : %La\n", 0x2.0p-16385l);
puts(  " [Rounded]");
printf("423.2323l (.10) :%.10La\n", 423.2323l);
printf("423.2323l (.20) :%.20La\n", 423.2323l);
printf("423.2323l (.1) : %.1La\n", 423.2323l);
printf("423.2323l (.0) : %.0La\n", 423.2323l);
printf("0.0l (.10) : %.10La\n", 0.0l);
printf("0.0l (.0) :  %.0La\n", 0.0l);
printf("-423.2323l (.10) :   %.10La\n", -423.2323l);
printf("-423.2323l (.20) :   %.20La\n", -423.2323l);
printf("-423.2323l (.1) :%.1La\n", -423.2323l);
printf("-423.2323l (.0) :%.0La\n", -423.2323l);
printf("-0.0l (.10) :%.10La\n", -0.0l);
printf("-0.0l (.0) : %.0La\n", -0.0l);
printf("0xF.8p+0l (.0) : %.0La\n", 0xF.8p+0l);
printf("0xF.7p+0l (.0) : %.0La\n", 0xF.7p+0l);
printf("0xF.F8p+0l (.1) :%.1La\n", 0xF.F8p+0l);
printf("0xF.F7p+0l (.1) :%.1La\n", 0xF.F7p+0l);
printf("0x0.008p+0l (.1) : %.1La\n", 
0x0.008p+0l);
printf("0x0.007p+0l (.1) : %.1La\n", 
0x0.007p+0l);
printf("LDBL_MAX (.5) :  %.5La\n", LDBL_MAX);

return EXIT_SUCCESS;
}>From d65015f4d40617a6b82ae0bf3c8c6afe94b1b79a Mon Sep 17 00:00:00 2001
From: Patrick Northon 
Date: Sun, 5 Sep 2021 17:31:17 -0400
Subject: [PATCH] Fix exponent when formatting long double in hexadecimal.

Some denormalized values were emited incorrectly. The leading digit will always assume to start at the 4th bit from the highest order bit in the mantissa and the exponent will be adjusted accordingly.
---
 mingw-w64-crt/stdio/mingw_pformat.c | 28 
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/mingw-w64-crt/stdio/mingw_pformat.c b/mingw-w64-crt/stdio/mingw_pformat.c
index 2e090c02f..1114cdbd9 100644
--- a/mingw-w64-crt/stdio/mingw_pformat.c
+++ b/mingw-w64-crt/stdio/mingw_pformat.c
@@ -2002,6 +2002,12 @@ void __pformat_emit_xfloat( __pformat_fpreg_t value, __pformat_t *stream )
   char buf[18 + 6], *p = buf;
   __pformat_intarg_t exponent; short exp_width = 2;
   
+  /* Reduce the exponent since the leading digit emited will start at 
+   * the 4th bit from the highest order bit instead, the later being 
+   * the leading digit of the floating point.
+   */
+  value.__pformat_fpreg_exponent -= 3;
+
   /* The mantissa field of the argument value representation can
* accommodate at most 16 hexadecimal digits, of which one will
* be placed 

Re: [Mingw-w64-public] [PATCH] wtypes.h: replace #include <...> with #include "..." for rpc

2021-09-05 Thread LIU Hao

在 2021-09-05 23:00, Jacek Caban 写道:


They come from widl, so if we want this change, then widl needs to be changed instead. It looks like 
the reverse was done in the past:


https://source.winehq.org/git/wine.git/commitdiff/0bde2bbe010c68a54f8928469e89637a2322ae44

I don't know what was the reasoning there, it seems fine to change it back.




Thanks for the information. It seems that, in Windows SDK 10.0.22000.0 the only non-WinRT header 
that is generated from an IDL and contains `#include ` is 
'microsoft.diagnostics.appanalysis.h'. All other non-WinRT headers use "" instead of <>. Please 
forward this discussion to Wine; in case of any upstream changes, we can backport them to mingw-w64.



--
Best regards,
LIU Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] wtypes.h: replace #include <...> with #include "..." for rpc

2021-09-05 Thread Jacek Caban

On 9/5/21 4:54 PM, LIU Hao wrote:

在 2021-09-04 23:53, JonY via Mingw-w64-public 写道:


I am OK with updating them to use double quotes but have no strong 
preference anyway since it has been using angular brackets for a long 
time.





So this change is okay, but... I have noticed that wtypes.h is 
generated from wtypes.idl, which contains no reference to  or 
. I don't know where those includes come from. Jacek, do you 
have any ideas?



They come from widl, so if we want this change, then widl needs to be 
changed instead. It looks like the reverse was done in the past:


https://source.winehq.org/git/wine.git/commitdiff/0bde2bbe010c68a54f8928469e89637a2322ae44

I don't know what was the reasoning there, it seems fine to change it back.


Thanks,

Jacek



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


Re: [Mingw-w64-public] [PATCH] wtypes.h: replace #include <...> with #include "..." for rpc

2021-09-05 Thread LIU Hao

在 2021-09-04 23:53, JonY via Mingw-w64-public 写道:


I am OK with updating them to use double quotes but have no strong preference anyway since it has 
been using angular brackets for a long time.





So this change is okay, but... I have noticed that wtypes.h is generated from wtypes.idl, which 
contains no reference to  or . I don't know where those includes come from. Jacek, 
do you have any ideas?



--
Best regards,
LIU Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] contributions

2021-09-05 Thread Glenn Burkhardt
I don't know if those functions are available from Cygwin.  But they are 
not in MinGW-w64.  I don't care how they get to MinGW-w64, it would be 
convenient to have them.


And why do you bring up Cygwin?  This is the MinGW-w64 mailing list, right?

On 9/4/2021  4:47 PM, Biswapriyo Nath wrote:

Subject:
Re: [Mingw-w64-public] contributions
From:
Biswapriyo Nath 
Date:
9/4/2021, 4:47 PM

To:
mingw-w64-public@lists.sourceforge.net


Are not you reinventing what cygwin already has?




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