mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-31 18:32:12 +00:00
Simplify printing for float and complex types
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user