Explicitly template instantiate `std::min/max` in a couple places
authorJosh Watzman <jwatzman@fb.com>
Mon, 4 May 2015 21:54:40 +0000 (14:54 -0700)
committerPraveen Kumar Ramakrishnan <praveenr@fb.com>
Tue, 12 May 2015 00:02:14 +0000 (17:02 -0700)
Summary:
This is for OS X; there is apparently some difference between
its types and Linux's typical types, causing incomopatibilities between
a `long int` and a `long long int`. These two explicit template
instantiations fix the issue.

Test Plan: g++-4.9 on OS X compiles these files now.

Reviewed By: lucian@fb.com

Subscribers: folly-diffs@, yfeldblum, chalfant

FB internal diff: D2040509

Signature: t1:2040509:1430516624:9db8146b7824c0d09bac418a10a5f54451cdd5db

folly/MemoryMapping.cpp
folly/experimental/fibers/EventBaseLoopController-inl.h

index 3d8e3a55bf2aeaef44477261133c40a353fbe98f..e09c391ef5729f3ad70d7f65b0aeb7388c4add9f 100644 (file)
@@ -311,7 +311,7 @@ void MemoryMapping::advise(int advice, size_t offset, size_t length) const {
   }
 
   length = (length + options_.pageSize - 1) & ~(options_.pageSize - 1);
-  length = std::min(length, mapLength_ - offset);
+  length = std::min<size_t>(length, mapLength_ - offset);
 
   char* mapStart = static_cast<char*>(mapStart_) + offset;
   PLOG_IF(WARNING, ::madvise(mapStart, length, advice)) << "madvise";
index a38d3637436ff35c6ca96a1369a48f5119dddbfa..363cef2f7be7635ea83a4f3cd49dd82a9545d994 100644 (file)
@@ -98,7 +98,7 @@ inline void EventBaseLoopController::timedSchedule(std::function<void()> func,
   auto delay_ms = std::chrono::duration_cast<
     std::chrono::milliseconds>(time - Clock::now()).count() + 1;
   // If clock is not monotonic
-  delay_ms = std::max(delay_ms, 0L);
+  delay_ms = std::max<long long int>(delay_ms, 0L);
   eventBase_->tryRunAfterDelay(func, delay_ms);
 }