MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / calculate_progress_perc

Method calculate_progress_perc

OpenHD/ohd_common/src/openhd_util.cpp:325–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325int8_t OHDUtil::calculate_progress_perc(int progress, int total_count) {
326 if (progress >= total_count) return 100;
327 if (total_count <= 0) return 100;
328 const double perc = ((double)progress / (double)total_count * 100.0);
329 return (int8_t)std::lround(perc);
330}
331
332// https://codeforwin.org/c-programming/c-program-to-get-value-of-nth-bit-of-number
333bool OHDUtil::get_nth_bit(long number, int position) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected