| 1486 | } |
| 1487 | |
| 1488 | void substr_str(const char* str, int start_index, int end_index, char* substring) { |
| 1489 | int substring_length = end_index - start_index + 1; |
| 1490 | strncpy(substring, str + start_index, substring_length); |
| 1491 | substring[substring_length] = '\0'; |
| 1492 | } |
| 1493 | |
| 1494 | int map_vals(int value, int from_min, int from_max, int to_min, int to_max) { |
| 1495 | return (value - from_min) * (to_max - to_min) / (from_max - from_min) + to_min; |