Add new #soa and #vector syntax

This commit is contained in:
gingerBill
2019-11-17 10:30:37 -08:00
parent 301ee664e9
commit d22e5b697d
9 changed files with 895 additions and 392 deletions
+9 -3
View File
@@ -394,6 +394,13 @@ write_type :: proc(buf: ^strings.Builder, ti: ^rt.Type_Info) {
write_type(buf, info.value);
case rt.Type_Info_Struct:
if info.soa_base_type != nil {
write_string(buf, "#soa[");
write_i64(buf, i64(info.soa_len));
write_byte(buf, ']');
write_type(buf, info.soa_base_type);
break;
}
write_string(buf, "struct ");
if info.is_packed do write_string(buf, "#packed ");
if info.is_raw_union do write_string(buf, "#raw_union ");
@@ -479,11 +486,10 @@ write_type :: proc(buf: ^strings.Builder, ti: ^rt.Type_Info) {
if info.is_x86_mmx {
write_string(buf, "intrinsics.x86_mmx");
} else {
write_string(buf, "intrinsics.vector(");
write_string(buf, "#vector[");
write_i64(buf, i64(info.count));
write_string(buf, ", ");
write_byte(buf, ']');
write_type(buf, info.elem);
write_byte(buf, ')');
}
}
}
+9 -3
View File
@@ -183,6 +183,13 @@ print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
print_type(fd, info.value);
case Type_Info_Struct:
if info.soa_base_type != nil {
os.write_string(fd, "#soa[");
print_u64(fd, u64(info.soa_len));
os.write_byte(fd, ']');
print_type(fd, info.soa_base_type);
break;
}
os.write_string(fd, "struct ");
if info.is_packed do os.write_string(fd, "#packed ");
if info.is_raw_union do os.write_string(fd, "#raw_union ");
@@ -263,11 +270,10 @@ print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
if info.is_x86_mmx {
os.write_string(fd, "intrinsics.x86_mmx");
} else {
os.write_string(fd, "intrinsics.vector(");
os.write_string(fd, "#vector[");
print_u64(fd, u64(info.count));
os.write_string(fd, ", ");
os.write_byte(fd, ']');
print_type(fd, info.elem);
os.write_byte(fd, ')');
}
}
}