Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-30 Thread JonY
On 5/30/2013 06:45, dw wrote: On 5/24/2013 8:43 PM, dw wrote: I looked at the hand-crafted and the built-in, and they both generate the same code. In the end, I went with the __sync_fetch_and_OP() built-in (attached). The comments above still apply. I'm going to wait for this patch to get

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-29 Thread dw
On 5/24/2013 8:43 PM, dw wrote: I looked at the hand-crafted and the built-in, and they both generate the same code. In the end, I went with the __sync_fetch_and_OP() built-in (attached). The comments above still apply. I'm going to wait for this patch to get committed before sending the

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-24 Thread Václav Zeman
On 05/20/2013 03:57 AM, dw wrote: There is a bug in the InterlockedOr function (as well as InterlockedAnd, InterlockedXor, InterlockedOr64, InterlockedAnd64, InterlockedXor64) where they do not return the old value as expected, but instead return (sort of) the new value. This code illustrates

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-23 Thread dw
In summary, this patch: 1) Correctly returns the old value. 2) Uses builtin function instead of inline asm. Nice catch. Patch is ok. Could you please also prepare patch for crt's intrinsic-implementation files? As before, plus: 3) Fixes both winnt.h and the crt intrinsic files. 4) Uses

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-21 Thread Kai Tietz
2013/5/21 dw limegreenso...@yahoo.com: Could you please also prepare patch for crt's intrinsic-implementation files? I've been pondering how to do this, both for the InterlockedOr functions and the __stos* functions. Duplicating the same code in two places goes against my nature. I figure

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-21 Thread dw
the idea to put all intrinsics within one new header, I don't like either. Sorry, my fault. I wasn't clear. This isn't what I was proposing. I'm suggesting intrnmac.h only contains the macro definitions. So we would move this code from winnt.h (which is where it is now) to intrnmac.h:

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-21 Thread Kai Tietz
2013/5/21 dw limegreenso...@yahoo.com: the idea to put all intrinsics within one new header, I don't like either. Sorry, my fault. I wasn't clear. This isn't what I was proposing. I'm suggesting intrnmac.h only contains the macro definitions. So we would move this code from winnt.h

Re: [Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-20 Thread Kai Tietz
2013/5/20 dw limegreenso...@yahoo.com: There is a bug in the InterlockedOr function (as well as InterlockedAnd, InterlockedXor, InterlockedOr64, InterlockedAnd64, InterlockedXor64) where they do not return the old value as expected, but instead return (sort of) the new value. This code

[Mingw-w64-public] [PATCH] Fix bug in InterlockedOr

2013-05-19 Thread dw
There is a bug in the InterlockedOr function (as well as InterlockedAnd, InterlockedXor, InterlockedOr64, InterlockedAnd64, InterlockedXor64) where they do not return the old value as expected, but instead return (sort of) the new value. This code illustrates the problem: #include stdio.h