Advertisement
Guest User

Untitled

a guest
Oct 21st, 2015
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.06 KB | None | 0 0
  1. diff --git gcc/toplev.c gcc/toplev.c
  2. index d37c507..09b2f89 100644
  3. --- gcc/toplev.c
  4. +++ gcc/toplev.c
  5. @@ -540,9 +540,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
  6.    if (x == 0)
  7.      return -1;
  8.  
  9. -#ifdef CLZ_HWI
  10. -  t = HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x);
  11. -#else
  12.    if (HOST_BITS_PER_WIDE_INT > 64)
  13.      if (x >= (unsigned HOST_WIDE_INT) 1 << (t + 64))
  14.        t += 64;
  15. @@ -559,7 +556,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
  16.      t += 2;
  17.    if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 1))
  18.      t += 1;
  19. -#endif
  20.  
  21.    return t;
  22.  }
  23. @@ -572,11 +572,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
  24.  {
  25.    if (x != (x & -x))
  26.      return -1;
  27. -#ifdef CTZ_HWI
  28. -  return x ? CTZ_HWI (x) : -1;
  29. -#else
  30.    return floor_log2 (x);
  31. -#endif
  32.  }
  33.  
  34.  #endif /*  GCC_VERSION < 3004 || !defined (__cplusplus)  */
  35. diff --git a/gcc/toplev.h b/gcc/toplev.h
  36. index e62aa727..cca6867 100644
  37. --- gcc/toplev.h
  38. +++ gcc/toplev.h
  39. @@ -167,14 +167,16 @@ extern void decode_d_option               (const char *);
  40.  extern bool fast_math_flags_set_p      (void);
  41.  extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
  42.  
  43. +/* Inline versions of the above for speed. */
  44. +#if GCC_VERSION < 3004
  45. +
  46.  /* Return log2, or -1 if not exact.  */
  47.  extern int exact_log2                  (unsigned HOST_WIDE_INT);
  48.  
  49.  /* Return floor of log2, with -1 for zero.  */
  50.  extern int floor_log2                  (unsigned HOST_WIDE_INT);
  51.  
  52. -/* Inline versions of the above for speed.  */
  53. -#if GCC_VERSION >= 3004
  54. +#else /* GCC_VERSION >= 3004 */
  55.  # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
  56.  #  define CLZ_HWI __builtin_clzl
  57.  #  define CTZ_HWI __builtin_ctzl
  58. @@ -186,13 +188,13 @@ extern int floor_log2                  (unsigned HOST_WIDE_INT);
  59.  #  define CTZ_HWI __builtin_ctz
  60.  # endif
  61.  
  62. -extern inline int
  63. +static inline int
  64.  floor_log2 (unsigned HOST_WIDE_INT x)
  65.  {
  66.    return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
  67.  }
  68.  
  69. -extern inline int
  70. +static inline int
  71.  exact_log2 (unsigned HOST_WIDE_INT x)
  72.  {
  73.    return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement