From 74fa7ca25ddb4c2fc7a600d0089b1a18f6465b69 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 26 Nov 2017 18:36:46 +0000 Subject: New slice memory layout (ptr+len); `byte` --- src/types.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/types.cpp') diff --git a/src/types.cpp b/src/types.cpp index f5acd073b..8dae03451 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -327,6 +327,7 @@ gb_global Type *t_untyped_nil = &basic_types[Basic_UntypedNil]; gb_global Type *t_untyped_undef = &basic_types[Basic_UntypedUndef]; + gb_global Type *t_u8_ptr = nullptr; gb_global Type *t_int_ptr = nullptr; gb_global Type *t_i64_ptr = nullptr; @@ -2127,8 +2128,8 @@ i64 type_size_of_internal(gbAllocator allocator, Type *t, TypePath *path) { } break; - case Type_Slice: // ptr + count - return 3 * build_context.word_size; + case Type_Slice: // ptr + len + return 2 * build_context.word_size; case Type_DynamicArray: // data + len + cap + allocator(procedure+data) -- cgit v1.2.3