diff --git a/universal7885-common/apps/SamsungParts/jni/Storage.cpp b/universal7885-common/apps/SamsungParts/jni/Storage.cpp index 73c68bf..f94f832 100644 --- a/universal7885-common/apps/SamsungParts/jni/Storage.cpp +++ b/universal7885-common/apps/SamsungParts/jni/Storage.cpp @@ -1,23 +1,16 @@ #include #include +#include #include namespace fs = std::filesystem; -double roundDouble(double origin) { - int first = static_cast(origin); - double second = origin - first; - second = static_cast(second * 10); - return static_cast(first *= 10 + second) / 10; -} - extern "C" JNIEXPORT jdouble JNICALL Java_com_eurekateam_samsungextras_interfaces_Swap_getFreeSpace(JNIEnv /*env*/, jclass /*clazz*/) { fs::space_info data = fs::space("/data"); auto freespace = data.free / 1024 / 1024; - auto result = static_cast(freespace) / 1024; - return roundDouble(result); + return std::round((static_cast(freespace) / 1024) / 0.1) * 0.1; } extern "C" JNIEXPORT jlong JNICALL