46 return __sync_add_and_fetch(pValue,1);
52 return __sync_sub_and_fetch(pValue,1);
57 return __sync_bool_compare_and_swap(io_pDest, in_expectedOldVal, in_newValue);
62 return __sync_bool_compare_and_swap(io_pDest, in_expectedOldVal, in_newValue);
76 struct timespec clockNow;
77 clock_gettime(CLOCK_MONOTONIC, &clockNow);
78 *out_piLastTime = ((clockNow.tv_sec + clockNow.tv_nsec/ 1000000000.0) * CLOCKS_PER_SEC);
85 *out_piFreq = CLOCKS_PER_SEC;
88 template<
class destType,
class srcType>
89 inline size_t AkSimpleConvertString( destType* in_pdDest,
const srcType* in_pSrc,
size_t in_MaxSize,
size_t destStrLen(
const destType *),
size_t srcStrLen(
const srcType *) )
92 size_t lenToCopy = srcStrLen(in_pSrc);
94 lenToCopy = (lenToCopy > in_MaxSize-1) ? in_MaxSize-1 : lenToCopy;
95 for(i = 0; i < lenToCopy; i++)
97 in_pdDest[i] = (destType) in_pSrc[i];
99 in_pdDest[lenToCopy] = (destType)0;
104 #define CONVERT_UTF16_TO_CHAR( _astring_, _charstring_ ) \
105 _charstring_ = (char*)AkAlloca( (1 + AKPLATFORM::AkUtf16StrLen((const AkUtf16*)_astring_)) * sizeof(char) ); \
106 AK_UTF16_TO_CHAR( _charstring_, (const AkUtf16*)_astring_, AKPLATFORM::AkUtf16StrLen((const AkUtf16*)_astring_)+1 )
108 #define AK_UTF16_TO_CHAR( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, strlen, AKPLATFORM::AkUtf16StrLen )
109 #define AK_UTF16_TO_OSCHAR( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, strlen, AKPLATFORM::AkUtf16StrLen )
110 #define AK_UTF16_TO_WCHAR( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, wcslen, AKPLATFORM::AkUtf16StrLen )
111 #define AK_CHAR_TO_UTF16( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, AKPLATFORM::AkUtf16StrLen, strlen )
112 #define AK_OSCHAR_TO_UTF16( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, AKPLATFORM::AkUtf16StrLen, strlen )
113 #define AK_WCHAR_TO_UTF16( in_pdDest, in_pSrc, in_MaxSize ) AKPLATFORM::AkSimpleConvertString( in_pdDest, in_pSrc, in_MaxSize, AKPLATFORM::AkUtf16StrLen, wcslen )
116 #define AkAlloca( _size_ ) __builtin_alloca( _size_ )
AkInt32 AkInterlockedDecrement(AkAtomic32 *pValue)
Platform Independent Helper.
void PerformanceCounter(AkInt64 *out_piLastTime)
Platform Independent Helper.
size_t AkSimpleConvertString(destType *in_pdDest, const srcType *in_pSrc, size_t in_MaxSize, size_t destStrLen(const destType *), size_t srcStrLen(const srcType *))
AkInt32 AkAtomic32
Signed 32-bit integer - Atomic Declaration.
void PerformanceFrequency(AkInt64 *out_piFreq)
Platform Independent Helper.
bool AkInterlockedCompareExchange(volatile AkAtomic32 *io_pDest, AkInt32 in_newValue, AkInt32 in_expectedOldVal)
AkInt64 AkAtomic64
Signed 64-bit integer - Atomic Declaration.
AkInt32 AkInterlockedIncrement(AkAtomic32 *pValue)
Platform Independent Helper.