From: Thomas Vander Stichele Date: Mon, 10 Oct 2005 16:38:59 +0000 (+0000) Subject: gst/gstutils.c: apparently converting from guint64 to double is not implemented on... X-Git-Tag: RELEASE-0_9_4~151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d129e575781154bcca3bcf82e5473d87e8c1ba0;p=platform%2Fupstream%2Fgstreamer.git gst/gstutils.c: apparently converting from guint64 to double is not implemented on MSVC Original commit message from CVS: * gst/gstutils.c: (guint64_to_gdouble), (gst_util_uint64_scale): apparently converting from guint64 to double is not implemented on MSVC --- diff --git a/ChangeLog b/ChangeLog index e3d96e7..7e2f4ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-10 Thomas Vander Stichele + + * gst/gstutils.c: (guint64_to_gdouble), (gst_util_uint64_scale): + apparently converting from guint64 to double is not implemented + on MSVC + 2005-10-10 Wim Taymans * check/Makefile.am: diff --git a/gst/gstutils.c b/gst/gstutils.c index a366d6a..697b618 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -299,6 +299,21 @@ gst_util_set_object_arg (GObject * object, const gchar * name, } } +#ifdef WIN32 +/* work around error C2520: conversion from unsigned __int64 to double + * not implemented, use signed __int64 */ +static gdouble +guint64_to_gdouble (guint64 value) +{ + if (value & 0x8000000000000000) + return (gdouble) ((gint64) value) + (gdouble) 18446744073709551616.; + else + return (gdouble) ((gint64) value); +} +#else +#define guint64_to_gdouble(value) ((gdouble) value) +#endif + /** * gst_util_uint64_scale: * @val: the number to scale @@ -313,7 +328,7 @@ guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom) { /* implement me with fixed point, if you care */ - return val * (((double) num) / denom); + return val * ((guint64_to_gdouble (num)) / denom); } /* -----------------------------------------------------