Fix integer conversion on 32-bit
This commit is contained in:
committed by
Space
parent
eaed67df29
commit
91a852d3fd
@@ -58,6 +58,10 @@ size_t kotlin::GetPeakResidentSetSizeBytes() noexcept {
|
|||||||
|
|
||||||
extern "C" RUNTIME_NOTHROW KLong Kotlin_MemoryUsageInfo_getPeakResidentSetSizeBytes() {
|
extern "C" RUNTIME_NOTHROW KLong Kotlin_MemoryUsageInfo_getPeakResidentSetSizeBytes() {
|
||||||
auto result = kotlin::GetPeakResidentSetSizeBytes();
|
auto result = kotlin::GetPeakResidentSetSizeBytes();
|
||||||
auto boundedResult = std::min<decltype(result)>(result, std::numeric_limits<KLong>::max());
|
// TODO: Need a common implementation for such conversions.
|
||||||
return static_cast<KLong>(boundedResult);
|
if constexpr (sizeof(decltype(result)) >= sizeof(KLong)) {
|
||||||
|
return static_cast<KLong>(std::min<decltype(result)>(result, std::numeric_limits<KLong>::max()));
|
||||||
|
} else {
|
||||||
|
return std::min<KLong>(result, std::numeric_limits<KLong>::max());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user