mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
Simplify printing for float and complex types
This commit is contained in:
+4
-10
@@ -646,17 +646,11 @@ __print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
|
|||||||
case Type_Info_Rune:
|
case Type_Info_Rune:
|
||||||
os.write_string(fd, "rune");
|
os.write_string(fd, "rune");
|
||||||
case Type_Info_Float:
|
case Type_Info_Float:
|
||||||
switch ti.size {
|
os.write_byte(fd, 'f');
|
||||||
case 2: os.write_string(fd, "f16");
|
__print_u64(fd, u64(8*ti.size));
|
||||||
case 4: os.write_string(fd, "f32");
|
|
||||||
case 8: os.write_string(fd, "f64");
|
|
||||||
}
|
|
||||||
case Type_Info_Complex:
|
case Type_Info_Complex:
|
||||||
switch ti.size {
|
os.write_string(fd, "complex");
|
||||||
case 4: os.write_string(fd, "complex32");
|
__print_u64(fd, u64(8*ti.size));
|
||||||
case 8: os.write_string(fd, "complex64");
|
|
||||||
case 16: os.write_string(fd, "complex128");
|
|
||||||
}
|
|
||||||
case Type_Info_String:
|
case Type_Info_String:
|
||||||
os.write_string(fd, "string");
|
os.write_string(fd, "string");
|
||||||
case Type_Info_Boolean:
|
case Type_Info_Boolean:
|
||||||
|
|||||||
+4
-10
@@ -172,17 +172,11 @@ write_type :: proc(buf: ^String_Buffer, ti: ^Type_Info) {
|
|||||||
case Type_Info_Rune:
|
case Type_Info_Rune:
|
||||||
write_string(buf, "rune");
|
write_string(buf, "rune");
|
||||||
case Type_Info_Float:
|
case Type_Info_Float:
|
||||||
switch ti.size {
|
write_byte(buf, 'f');
|
||||||
case 2: write_string(buf, "f16");
|
write_i64(buf, i64(8*ti.size), 10);
|
||||||
case 4: write_string(buf, "f32");
|
|
||||||
case 8: write_string(buf, "f64");
|
|
||||||
}
|
|
||||||
case Type_Info_Complex:
|
case Type_Info_Complex:
|
||||||
switch ti.size {
|
write_string(buf, 'complex');
|
||||||
case 4: write_string(buf, "complex32");
|
write_i64(buf, i64(8*ti.size), 10);
|
||||||
case 8: write_string(buf, "complex64");
|
|
||||||
case 16: write_string(buf, "complex128");
|
|
||||||
}
|
|
||||||
case Type_Info_String:
|
case Type_Info_String:
|
||||||
write_string(buf, "string");
|
write_string(buf, "string");
|
||||||
case Type_Info_Boolean:
|
case Type_Info_Boolean:
|
||||||
|
|||||||
Reference in New Issue
Block a user