Emulate C99's lldiv() if necessary

This commit is contained in:
Eric Petit 2006-03-08 23:32:08 +00:00
parent c8f1e3fdf6
commit 1b73c740f3
3 changed files with 25 additions and 1 deletions

View File

@ -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) 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 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(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)]) AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)]) AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])

View File

@ -873,6 +873,17 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# define vlc_strtoll NULL # define vlc_strtoll NULL
#endif #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 #ifndef HAVE_SCANDIR
# define scandir vlc_scandir # define scandir vlc_scandir
# define alphasort vlc_alphasort # define alphasort vlc_alphasort

View File

@ -343,6 +343,19 @@ int64_t vlc_atoll( const char *nptr )
} }
#endif #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 * vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\' * when called with an empty argument or just '\'