Browse Source

Remove old procedures

gingerBill 7 years ago
parent
commit
2e92d0c821
1 changed files with 0 additions and 104 deletions
  1. 0 104
      core/mem.odin

+ 0 - 104
core/mem.odin

@@ -204,111 +204,7 @@ end_arena_temp_memory :: proc(using tmp: ArenaTempMemory) {
 
 
 
-
-
-
-
-align_of_type_info :: proc(type_info: ^Type_Info) -> int {
-	prev_pow2 :: proc(n: i64) -> i64 {
-		if n <= 0 do return 0;
-		n |= n >> 1;
-		n |= n >> 2;
-		n |= n >> 4;
-		n |= n >> 8;
-		n |= n >> 16;
-		n |= n >> 32;
-		return n - (n >> 1);
-	}
-
-	WORD_SIZE :: size_of(int);
-	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);
-	case Type_Info_Integer:
-		return type_info.align;
-	case Type_Info_Rune:
-		return type_info.align;
-	case Type_Info_Float:
-		return type_info.align;
-	case Type_Info_String:
-		return WORD_SIZE;
-	case Type_Info_Boolean:
-		return 1;
-	case Type_Info_Any:
-		return WORD_SIZE;
-	case Type_Info_Pointer:
-		return WORD_SIZE;
-	case Type_Info_Procedure:
-		return WORD_SIZE;
-	case Type_Info_Array:
-		return align_of_type_info(info.elem);
-	case Type_Info_Dynamic_Array:
-		return WORD_SIZE;
-	case Type_Info_Slice:
-		return WORD_SIZE;
-	case Type_Info_Tuple:
-		return type_info.align;
-	case Type_Info_Struct:
-		return type_info.align;
-	case Type_Info_Union:
-		return type_info.align;
-	case Type_Info_Enum:
-		return align_of_type_info(info.base);
-	case Type_Info_Map:
-		return align_of_type_info(info.generated_struct);
-	}
-
-	return 0;
-}
-
 align_formula :: proc(size, align: int) -> int {
 	result := size + align-1;
 	return result - result%align;
 }
-
-size_of_type_info :: proc(type_info: ^Type_Info) -> int {
-	WORD_SIZE :: size_of(int);
-	switch info in type_info.variant {
-	case Type_Info_Named:
-		return size_of_type_info(info.base);
-	case Type_Info_Integer:
-		return type_info.size;
-	case Type_Info_Rune:
-		return type_info.size;
-	case Type_Info_Float:
-		return type_info.size;
-	case Type_Info_String:
-		return 2*WORD_SIZE;
-	case Type_Info_Boolean:
-		return 1;
-	case Type_Info_Any:
-		return 2*WORD_SIZE;
-	case Type_Info_Pointer:
-		return WORD_SIZE;
-	case Type_Info_Procedure:
-		return WORD_SIZE;
-	case Type_Info_Array:
-		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_Dynamic_Array:
-		return size_of(rawptr) + 2*size_of(int) + size_of(Allocator);
-	case Type_Info_Slice:
-		return 2*WORD_SIZE;
-	case Type_Info_Struct:
-		return type_info.size;
-	case Type_Info_Union:
-		return type_info.size;
-	case Type_Info_Enum:
-		return size_of_type_info(info.base);
-	case Type_Info_Map:
-		return size_of_type_info(info.generated_struct);
-	}
-
-	return 0;
-}
-