Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_COMPILER_GCC_DEFS_H
# define CDS_DEPRECATED( reason ) __attribute__((deprecated( reason )))
#endif
+// likely/unlikely
+
+#define cds_likely( expr ) __builtin_expect( !!( expr ), 1 )
+#define cds_unlikely( expr ) __builtin_expect( !!( expr ), 0 )
+
+// double-width CAS support
+// note: gcc-4.8 does not support double-word atomics
+#if CDS_COMPILER_VERSION >= 40900
+# if CDS_BUILD_BITS == 64
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+# define CDS_DCAS_SUPPORT
+# endif
+# else
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+# define CDS_DCAS_SUPPORT
+# endif
+# endif
+#endif
+
#include <cds/compiler/gcc/compiler_barriers.h>
#endif // #ifndef CDSLIB_COMPILER_GCC_DEFS_H