* Takes a string like "64K" and "128M" and returns the corresponding size in * bytes, expanding the multiple prefixes to the actual size, like "65536" and * "134217728", respectively. */
| 3112 | * "134217728", respectively. |
| 3113 | */ |
| 3114 | std::size_t parse_size_string(std::string const &str) { |
| 3115 | std::size_t value = std::stoull(str); |
| 3116 | if (str.find("K") != std::string::npos || str.find("k") != std::string::npos) { value *= 1024; } |
| 3117 | else if (str.find("M") != std::string::npos || str.find("m") != std::string::npos) { value *= 1024 * 1024; } |
| 3118 | else if (str.find("G") != std::string::npos || str.find("g") != std::string::npos) { value *= 1024 * 1024 * 1024; } |
| 3119 | return value; |
| 3120 | } |
| 3121 | |
| 3122 | #pragma endregion // Non Uniform Memory Access |
| 3123 |
nothing calls this directly
no outgoing calls
no test coverage detected