Simplify printing for float and complex types

This commit is contained in:
gingerBill
2018-01-28 15:58:34 +00:00
parent 369db3a8e3
commit 9366fa8e95
2 changed files with 8 additions and 20 deletions

View File

@@ -646,17 +646,11 @@ __print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
case Type_Info_Rune:
os.write_string(fd, "rune");
case Type_Info_Float:
switch ti.size {
case 2: os.write_string(fd, "f16");
case 4: os.write_string(fd, "f32");
case 8: os.write_string(fd, "f64");
}
os.write_byte(fd, 'f');
__print_u64(fd, u64(8*ti.size));
case Type_Info_Complex:
switch ti.size {
case 4: os.write_string(fd, "complex32");
case 8: os.write_string(fd, "complex64");
case 16: os.write_string(fd, "complex128");
}
os.write_string(fd, "complex");
__print_u64(fd, u64(8*ti.size));
case Type_Info_String:
os.write_string(fd, "string");
case Type_Info_Boolean:

View File

@@ -172,17 +172,11 @@ write_type :: proc(buf: ^String_Buffer, ti: ^Type_Info) {
case Type_Info_Rune:
write_string(buf, "rune");
case Type_Info_Float:
switch ti.size {
case 2: write_string(buf, "f16");
case 4: write_string(buf, "f32");
case 8: write_string(buf, "f64");
}
write_byte(buf, 'f');
write_i64(buf, i64(8*ti.size), 10);
case Type_Info_Complex:
switch ti.size {
case 4: write_string(buf, "complex32");
case 8: write_string(buf, "complex64");
case 16: write_string(buf, "complex128");
}
write_string(buf, 'complex');
write_i64(buf, i64(8*ti.size), 10);
case Type_Info_String:
write_string(buf, "string");
case Type_Info_Boolean: