Commit 1b73c740 authored by Eric Petit's avatar Eric Petit

Emulate C99's lldiv() if necessary

parent c8f1e3fd
......@@ -404,7 +404,7 @@ need_libc=false
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat)
dnl Check for usual libc functions
AC_CHECK_FUNCS(strdup strndup atof)
AC_CHECK_FUNCS(strdup strndup atof lldiv)
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
......
......@@ -873,6 +873,17 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# define vlc_strtoll NULL
#endif
#ifndef HAVE_LLDIV
typedef struct {
long long quot; /* Quotient. */
long long rem; /* Remainder. */
} lldiv_t;
# define lldiv vlc_lldiv
VLC_EXPORT( lldiv_t, vlc_lldiv, ( long long numer, long long denom ) );
#elif !defined(__PLUGIN__)
# define vlc_lldiv NULL
#endif
#ifndef HAVE_SCANDIR
# define scandir vlc_scandir
# define alphasort vlc_alphasort
......
......@@ -343,6 +343,19 @@ int64_t vlc_atoll( const char *nptr )
}
#endif
/*****************************************************************************
* lldiv: returns quotient and remainder
*****************************************************************************/
#if !defined( HAVE_LLDIV )
lldiv_t vlc_lldiv( long long numer, long long denom )
{
lldiv_t d;
d.quot = numer / denom;
d.rem = numer % denom;
return d;
}
#endif
/*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment