webcamoid / akvirtualcamera

akvirtualcamera, virtual camera for Mac and Windows
GNU General Public License v3.0
408 stars 52 forks source link

Small patch for compiling under Windows 10 #20

Closed rse closed 3 years ago

rse commented 3 years ago

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)
hipersayanX commented 3 years ago

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.

hipersayanX commented 3 years ago

I've added a template for the sign instead.