cast time_t to 'long long' prior to bitshifting since it can be a float value according to POSIX.1-2008
closes #3439
#endif
])
MUTT_C99_INTTYPES
+AC_TYPE_LONG_LONG_INT
ac_aux_path_sendmail=/usr/sbin:/usr/lib
AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
/* POSIX.1-2008 states that seed is 'unsigned' without specifying its width.
* Use as many of the lower order bits from the current time of day as the seed.
* If the upper bound is truncated, that is fine.
+ *
+ * tv_sec is integral of type integer or float. Cast to 'long long' before
+ * bitshift in case it is a float.
*/
- seed = (tv.tv_sec << 20) | tv.tv_usec;
+ seed = ((LONGLONG) tv.tv_sec << 20) | tv.tv_usec;
srandom(seed);
}
* Prototypes for broken systems
*/
+#ifdef HAVE_LONG_LONG_INT
+#ifdef LONGLONG
+#error LONGLONG is already defined
+#endif
+#define LONGLONG long long
+#else
+#define LONGLONG long
+#endif
+
#ifdef HAVE_SRAND48
#define LRAND lrand48
#define SRAND srand48