webcamoid/akvirtualcamera

Small patch for compiling under Windows 10

rse opened this issue · 2 comments

rse commented

In order to be get the latest code of AkVirtualCamera as of yesterday to compile under Windows 10 with latest Visual Studio 16 2019 SDK, I had to apply the following small patch, because the available std::signbit() has no variant which is defined on int64_t. The long double was the closest floating point type which looks acceptable, as no integral type like long long was accepted. Please double check this, but I wanted to let you know that such a patch was needed to get AkVirtualCamery building under Windows 10...

--- VCamUtils/src/fraction.cpp
+++ VCamUtils/src/fraction.cpp
@@ -151,7 +151,7 @@ bool AkVCam::Fraction::isInfinity() const

 int AkVCam::Fraction::sign() const
 {
-    return std::signbit(this->d->m_num) == std::signbit(this->d->m_den)? 1: -1;
+    return std::signbit((long double)this->d->m_num) == std::signbit((long double)this->d->m_den)? 1: -1;
 }

 bool AkVCam::Fraction::isFraction(const std::string &str)

Or maybe replacing signbit() with a macro here or an inline here? because at the end I only interested on knowing if the number (or fraction) is positive or negative, it make not much sense to cast to a floating value just for that.

I've added a template for the sign instead.