![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 /* 00002 Copyright 2005-2010 Intel Corporation. All Rights Reserved. 00003 00004 This file is part of Threading Building Blocks. 00005 00006 Threading Building Blocks is free software; you can redistribute it 00007 and/or modify it under the terms of the GNU General Public License 00008 version 2 as published by the Free Software Foundation. 00009 00010 Threading Building Blocks is distributed in the hope that it will be 00011 useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00012 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with Threading Building Blocks; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 As a special exception, you may use this file as part of a free software 00020 library without restriction. Specifically, if other files instantiate 00021 templates or use macros or inline functions from this file, or you compile 00022 this file and link it with other files to produce an executable, this 00023 file does not by itself cause the resulting executable to be covered by 00024 the GNU General Public License. This exception does not however 00025 invalidate any other reasons why the executable file might be covered by 00026 the GNU General Public License. 00027 */ 00028 00029 #ifndef __TBB_machine_H 00030 #error Do not include this file directly; include tbb_machine.h instead 00031 #endif 00032 00033 #define NONET 00034 #define NOD3D 00035 #include "xtl.h" 00036 #include "ppcintrinsics.h" 00037 00038 #if _MSC_VER >= 1300 00039 extern "C" void _ReadWriteBarrier(); 00040 #pragma intrinsic(_ReadWriteBarrier) 00041 #define __TBB_release_consistency_helper() _ReadWriteBarrier() 00042 #endif 00043 00044 inline void __TBB_rel_acq_fence() { __lwsync(); } 00045 00046 #define __TBB_WORDSIZE 4 00047 #define __TBB_BIG_ENDIAN 1 00048 00049 //todo: define __TBB_DECL_FENCED_ATOMICS and define acquire/release primitives to maximize performance 00050 00051 typedef __int64 int64_t; //required for definition of Store8/Load8 in atomic.h 00052 typedef unsigned char uint8_t; //same reason 00053 00054 inline __int32 __TBB_machine_cmpswp4(volatile void *ptr, __int32 value, __int32 comparand ) 00055 { 00056 __lwsync(); 00057 __int32 result = InterlockedCompareExchange((volatile LONG*)ptr, value, comparand); 00058 __lwsync(); 00059 return result; 00060 } 00061 00062 inline __int64 __TBB_machine_cmpswp8(volatile void *ptr, __int64 value, __int64 comparand ) 00063 { 00064 __lwsync(); 00065 __int64 result = InterlockedCompareExchange64((volatile LONG64*)ptr, value, comparand); 00066 __lwsync(); 00067 return result; 00068 } 00069 00070 #pragma optimize( "", off ) 00071 inline void __TBB_machine_pause (__int32 delay ) 00072 { 00073 for (__int32 i=0; i<delay; i++) {;}; 00074 } 00075 #pragma optimize( "", on ) 00076 00077 00078 #define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) 00079 #define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) 00080 #define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) 00081 #define __TBB_Yield() Sleep(0) 00082 #define __TBB_Pause(V) __TBB_machine_pause(V) 00083 #define __TBB_fence_for_acquire() __lwsync() 00084 #define __TBB_fence_for_release() __lwsync() 00085
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.