aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert2013-09-24 07:53:49 -0700
committerPaul Eggert2013-09-24 07:53:49 -0700
commit4710d6f406ff792aaae65ad141f96346be44909d (patch)
treec4cf31d3c8292619363b0f998f8786968d3fcace /src/data.c
parent10ebac9d6af07da7650c490a39144177a25861e3 (diff)
downloademacs-4710d6f406ff792aaae65ad141f96346be44909d.tar.gz
emacs-4710d6f406ff792aaae65ad141f96346be44909d.zip
* data.c (POPCOUNT_STATIC_INLINE): New macro, as a hack for popcount.
This is ugly, but it should fix the performance problem for older GCC versions in the short run. I'll look into integrating the Gnulib module for popcount, as a better fix. See the thread starting in: http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00474.html (popcount_size_t_generic) [NEED_GENERIC_POPCOUNT]: (popcount_size_t_msc) [USE_MSC_POPCOUNT]: (popcount_size_t_gcc) [USE_GCC_POPCOUNT]: (popcount_size_t): Use it.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/data.c b/src/data.c
index 82cfd74cd0f..79679bae444 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2972,18 +2972,25 @@ bool_vector_spare_mask (ptrdiff_t nr_bits)
2972 2972
2973#if _MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64) 2973#if _MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64)
2974# define USE_MSC_POPCOUNT 2974# define USE_MSC_POPCOUNT
2975# define POPCOUNT_STATIC_INLINE static inline
2975#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 2976#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
2976# define USE_GCC_POPCOUNT 2977# define USE_GCC_POPCOUNT
2978# if 199901L <= __STDC_VERSION__ || !__STRICT_ANSI__
2979# define POPCOUNT_STATIC_INLINE static inline
2980# endif
2977#else 2981#else
2978# define NEED_GENERIC_POPCOUNT 2982# define NEED_GENERIC_POPCOUNT
2979#endif 2983#endif
2984#ifndef POPCOUNT_STATIC_INLINE
2985# define POPCOUNT_STATIC_INLINE static
2986#endif
2980 2987
2981#ifdef USE_MSC_POPCOUNT 2988#ifdef USE_MSC_POPCOUNT
2982#define NEED_GENERIC_POPCOUNT 2989# define NEED_GENERIC_POPCOUNT
2983#endif 2990#endif
2984 2991
2985#ifdef NEED_GENERIC_POPCOUNT 2992#ifdef NEED_GENERIC_POPCOUNT
2986static unsigned int 2993POPCOUNT_STATIC_INLINE unsigned int
2987popcount_size_t_generic (size_t val) 2994popcount_size_t_generic (size_t val)
2988{ 2995{
2989 unsigned short j; 2996 unsigned short j;
@@ -2997,7 +3004,7 @@ popcount_size_t_generic (size_t val)
2997#endif 3004#endif
2998 3005
2999#ifdef USE_MSC_POPCOUNT 3006#ifdef USE_MSC_POPCOUNT
3000static unsigned int 3007POPCOUNT_STATIC_INLINE unsigned int
3001popcount_size_t_msc (size_t val) 3008popcount_size_t_msc (size_t val)
3002{ 3009{
3003 unsigned int count; 3010 unsigned int count;
@@ -3042,7 +3049,7 @@ popcount_size_t_msc (size_t val)
3042#endif /* USE_MSC_POPCOUNT */ 3049#endif /* USE_MSC_POPCOUNT */
3043 3050
3044#ifdef USE_GCC_POPCOUNT 3051#ifdef USE_GCC_POPCOUNT
3045static unsigned int 3052POPCOUNT_STATIC_INLINE unsigned int
3046popcount_size_t_gcc (size_t val) 3053popcount_size_t_gcc (size_t val)
3047{ 3054{
3048# if BITS_PER_SIZE_T == 64 3055# if BITS_PER_SIZE_T == 64
@@ -3053,7 +3060,7 @@ popcount_size_t_gcc (size_t val)
3053} 3060}
3054#endif /* USE_GCC_POPCOUNT */ 3061#endif /* USE_GCC_POPCOUNT */
3055 3062
3056static unsigned int 3063POPCOUNT_STATIC_INLINE unsigned int
3057popcount_size_t (size_t val) 3064popcount_size_t (size_t val)
3058{ 3065{
3059#if defined USE_MSC_POPCOUNT 3066#if defined USE_MSC_POPCOUNT