This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][BZ #17943] Use long for int_fast8_t

Hi, as in bugzilla entry what is rationale of using char as int_fast8_t?

It is definitely slower with division, following code is 25% slower on
haswell with char than when you use long.

There is question what about other architectures and atomic operations,
are byte ones better than int?

int main ()
  int i;
  char x = 32;
  for (i=0; i<1000000000; i++)
    x = 11 * x + 5 + x / 3;
  return x;

	* sysdeps/generic/stdint.h: Use long int for int_fast8_t

diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 5c9f0ff..c6dda3b 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -87,12 +87,13 @@ typedef unsigned long long int	uint_least64_t;
 /* Fast types.  */
 /* Signed.  */
-typedef signed char		int_fast8_t;
 #if __WORDSIZE == 64
+typedef long int		int_fast8_t;
 typedef long int		int_fast16_t;
 typedef long int		int_fast32_t;
 typedef long int		int_fast64_t;
+typedef int			int_fast8_t;
 typedef int			int_fast16_t;
 typedef int			int_fast32_t;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]