aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-28 15:58:34 +0000
committergingerBill <bill@gingerbill.org>2018-01-28 15:58:34 +0000
commit9366fa8e951249bdce6f3ebc088dd8381ccba29d (patch)
tree10172f0d2e25babd3c4294eddea1d6cfce179e42 /core
parent369db3a8e34091f008ee8d3c3f8e2c45803cc9b0 (diff)
Simplify printing for float and complex types
Diffstat (limited to 'core')
-rw-r--r--core/_preload.odin14
-rw-r--r--core/fmt.odin14
2 files changed, 8 insertions, 20 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index 2fb162c75..234c064fd 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -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:
diff --git a/core/fmt.odin b/core/fmt.odin
index 3efbfb822..c38073741 100644
--- a/core/fmt.odin
+++ b/core/fmt.odin
@@ -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: