const interning for 1-possible-value types

This commit is contained in:
Michael Dusan
2019-11-25 15:04:49 -05:00
parent 8f3e972da6
commit a647a88dfc
9 changed files with 118 additions and 23 deletions

View File

@@ -121,18 +121,18 @@ SplitIterator memSplit(Slice<uint8_t> buffer, Slice<uint8_t> split_bytes) {
void zig_pretty_print_bytes(FILE *f, double n) {
if (n > 1024.0 * 1024.0 * 1024.0) {
fprintf(f, "%.02f GiB", n / 1024.0 / 1024.0 / 1024.0);
fprintf(f, "%.03f GiB", n / 1024.0 / 1024.0 / 1024.0);
return;
}
if (n > 1024.0 * 1024.0) {
fprintf(f, "%.02f MiB", n / 1024.0 / 1024.0);
fprintf(f, "%.03f MiB", n / 1024.0 / 1024.0);
return;
}
if (n > 1024.0) {
fprintf(f, "%.02f KiB", n / 1024.0);
fprintf(f, "%.03f KiB", n / 1024.0);
return;
}
fprintf(f, "%.02f bytes", n );
fprintf(f, "%.03f bytes", n );
return;
}