Remove vector type (will be replaced by something else in the future)

This commit is contained in:
gingerBill
2017-11-30 20:34:42 +00:00
parent e00d88d82e
commit 1a75dfe075
15 changed files with 41 additions and 704 deletions
+1 -3
View File
@@ -66,7 +66,6 @@ Type_Info_Array :: struct #ordered {
};
Type_Info_Dynamic_Array :: struct #ordered {elem: ^Type_Info, elem_size: int};
Type_Info_Slice :: struct #ordered {elem: ^Type_Info, elem_size: int};
Type_Info_Vector :: struct #ordered {elem: ^Type_Info, elem_size, count: int};
Type_Info_Tuple :: struct #ordered { // Only really used for procedures
types: []^Type_Info,
names: []string,
@@ -121,7 +120,6 @@ Type_Info :: struct #ordered {
Type_Info_Array,
Type_Info_Dynamic_Array,
Type_Info_Slice,
Type_Info_Vector,
Type_Info_Tuple,
Type_Info_Struct,
Type_Info_Union,
@@ -178,7 +176,7 @@ Context :: struct #ordered {
derived: any, // May be used for derived data types
}
DEFAULT_ALIGNMENT :: align_of([vector 4]f32);
DEFAULT_ALIGNMENT :: 2*align_of(rawptr);
__INITIAL_MAP_CAP :: 16;
-16
View File
@@ -244,11 +244,6 @@ write_type :: proc(buf: ^String_Buffer, ti: ^Type_Info) {
case Type_Info_Slice:
write_string(buf, "[]");
write_type(buf, info.elem);
case Type_Info_Vector:
write_string(buf, "[vector ");
write_int(buf, i64(info.count), 10);
write_string(buf, "]");
write_type(buf, info.elem);
case Type_Info_Map:
write_string(buf, "map[");
@@ -815,17 +810,6 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
fmt_arg(fi, any{rawptr(data), info.elem}, verb);
}
case Type_Info_Vector:
write_byte(fi.buf, '<');
defer write_byte(fi.buf, '>');
for i in 0..info.count {
if i > 0 do write_string(fi.buf, ", ");
data := uintptr(v.data) + uintptr(i*info.elem_size);
fmt_value(fi, any{rawptr(data), info.elem}, verb);
}
case Type_Info_Map:
if verb != 'v' {
fmt_bad_verb(fi, verb);
+1 -13
View File
@@ -220,7 +220,7 @@ align_of_type_info :: proc(type_info: ^Type_Info) -> int {
}
WORD_SIZE :: size_of(int);
MAX_ALIGN :: size_of([vector 64]f64); // TODO(bill): Should these constants be builtin constants?
MAX_ALIGN :: 2*align_of(rawptr); // TODO(bill): Should these constants be builtin constants?
switch info in type_info.variant {
case Type_Info_Named:
return align_of_type_info(info.base);
@@ -246,11 +246,6 @@ align_of_type_info :: proc(type_info: ^Type_Info) -> int {
return WORD_SIZE;
case Type_Info_Slice:
return WORD_SIZE;
case Type_Info_Vector:
size := size_of_type_info(info.elem);
count := int(max(prev_pow2(i64(info.count)), 1));
total := size * count;
return clamp(total, 1, MAX_ALIGN);
case Type_Info_Tuple:
return type_info.align;
case Type_Info_Struct:
@@ -303,13 +298,6 @@ size_of_type_info :: proc(type_info: ^Type_Info) -> int {
return size_of(rawptr) + 2*size_of(int) + size_of(Allocator);
case Type_Info_Slice:
return 2*WORD_SIZE;
case Type_Info_Vector:
count := info.count;
if count == 0 do return 0;
size := size_of_type_info(info.elem);
align := align_of_type_info(info.elem);
alignment := align_formula(size, align);
return alignment*(count-1) + size;
case Type_Info_Struct:
return type_info.size;
case Type_Info_Union:
-11
View File
@@ -78,12 +78,6 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
if !ok do return false;
return are_types_identical(x.elem, y.elem);
case Type_Info_Vector:
y, ok := b.variant.(Type_Info_Vector);
if !ok do return false;
if x.count != y.count do return false;
return are_types_identical(x.elem, y.elem);
case Type_Info_Tuple:
y, ok := b.variant.(Type_Info_Tuple);
if !ok do return false;
@@ -231,11 +225,6 @@ is_slice :: proc(info: ^Type_Info) -> bool {
_, ok := type_info_base(info).variant.(Type_Info_Slice);
return ok;
}
is_vector :: proc(info: ^Type_Info) -> bool {
if info == nil do return false;
_, ok := type_info_base(info).variant.(Type_Info_Vector);
return ok;
}
is_tuple :: proc(info: ^Type_Info) -> bool {
if info == nil do return false;
_, ok := type_info_base(info).variant.(Type_Info_Tuple);