~steve-sk2/mingw-w64/oneiric

« back to all changes in this revision

Viewing changes to mingw-w64-crt/intrincs/ilockxor64.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-11-18 00:04:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101118000446-xe24b423su55onyl
Tags: 1.0+20101003-1
* New maintainer. (Closes: #594371.)
* New upstream snapshot:
  - Includes getopt.h. (Closes: #569914.)
* Build g++ for Win64. (Closes: #600451.)
* Standards-Version 3.9.1 (new packaging).
* Include patch from
  http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64?view=revision&revision=3715
  as suggested by Rafaël Carré.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <intrin.h>
2
2
 
 
3
#ifdef _WIN64
3
4
__int64 _InterlockedXor64(__int64 volatile *Destination, __int64 Value)
4
5
{
5
6
  __asm__ __volatile__("lock ; xorq %0,%1"
6
7
    : : "r"(Value),"m"(*Destination) : "memory");
7
8
  return *Destination;
8
9
}
9
 
 
 
10
#else
 
11
__int64 __stdcall InterlockedCompareExchange64(__int64 volatile *Destination,
 
12
  __int64 Exchange, __int64 Comperand);
 
13
__int64 _InterlockedXor64 (__int64 volatile *Destination,__int64 Value);
 
14
__int64 _InterlockedXor64 (__int64 volatile *Destination,__int64 Value)
 
15
{
 
16
    __int64 Old;
 
17
    do {
 
18
      Old = *Destination;
 
19
    } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old);
 
20
 
 
21
    return Old;
 
22
  }
 
23
#endif
 
24
 
 
25
#ifdef _WIN64
10
26
__int64 InterlockedXor64(__int64 volatile *, __int64) __attribute__((alias("_InterlockedXor64")));
11
 
 
 
27
#else
 
28
__int64 __stdcall InterlockedXor64(__int64 volatile *Destination, __int64 Value)
 
29
{
 
30
  return _InterlockedXor64(Destination, Value);
 
31
}
 
32
#endif