Spaces:
Running
Running
| """Utility functions for the Nacrith CPU compressor.""" | |
| def format_size(num_bytes: int) -> str: | |
| """Format byte count as human-readable string.""" | |
| if num_bytes < 1024: | |
| return f"{num_bytes} B" | |
| elif num_bytes < 1024 * 1024: | |
| return f"{num_bytes / 1024:.1f} KB" | |
| else: | |
| return f"{num_bytes / (1024 * 1024):.2f} MB" | |