Changeset 328 for trunk/Include


Ignore:
Timestamp:
Sep 8, 2007, 8:41:52 PM (17 years ago)
Author:
dai
Message:

x64版のInterlockedIncrement関数の簡易版を用意。(#135に関連する)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/api_system.sbp

    r300 r328  
    218218'----------------------
    219219' Kernel Operation API
     220#ifdef _WIN64
     221Function InterlockedIncrement(ByRef lpAddend As Long) As Long
     222    lpAddend++
     223    Return lpAddend
     224End Function
     225Function InterlockedDecrement(ByRef lpAddend As Long) As Long
     226    lpAddend--
     227    Return lpAddend
     228End Function
     229Function InterlockedExchange(ByRef Target As Long, Value As Long) As Long
     230    Target = Value
     231    Return Target
     232End Function
     233Function InterlockedCompareExchange(ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
     234    InterlockedCompareExchange = Destination
     235    If Destination = Comperand Then
     236        Destination = Exchange
     237    End If
     238End Function
     239Function InterlockedExchangeAdd(ByRef Addend As Long, Value As Long) As Long
     240    InterlockedExchangeAdd = Addend
     241    Addend += Value
     242End Function
     243Function InterlockedExchangePointer(ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
     244    Target = Value
     245    Return Target
     246End Function
     247Function InterlockedCompareExchangePointer(ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
     248    InterlockedCompareExchangePointer = Destination
     249    If Destination = Comperand Then
     250        Destination = Exchange
     251    End If
     252End Function
     253#else
    220254Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long
    221255Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long
     
    223257Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
    224258Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long
    225 #ifdef _WIN64
    226 Declare Function InterlockedCompareExchangePointer Lib "kernel32" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
    227 Declare Function InterlockedExchangePointer Lib "kernel32" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
    228 #else
    229259Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
    230260Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
Note: See TracChangeset for help on using the changeset viewer.