aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorzhiayang <zhiayang@gmail.com>2017-02-02 04:21:42 +0800
committerzhiayang <zhiayang@gmail.com>2017-02-02 04:21:42 +0800
commit5516e80ab775d1100beca7847e10520eae4b151c (patch)
treefd080deab099e74ec5f50841c6a8b5b5b8b5c3c4 /core
parent864310e3da059371ac7345ee3bf900a6055f26b4 (diff)
parent4e7082a68dd5261c3c36eccf92a62a0ce84995a8 (diff)
Merge branch 'master' of https://github.com/zhiayang/Odin
Diffstat (limited to 'core')
-rw-r--r--core/_preload.odin20
-rw-r--r--core/utf8.odin4
2 files changed, 22 insertions, 2 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index 24c682c8d..107e61dd2 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -321,6 +321,21 @@ __string_decode_rune :: proc(s: string) -> (rune, int) #inline {
}
+Raw_Any :: struct #ordered {
+ type_info: ^Type_Info,
+ data: rawptr,
+}
+
+Raw_String :: struct #ordered {
+ data: ^byte,
+ count: int,
+};
+
+Raw_Slice :: struct #ordered {
+ data: rawptr,
+ count: int,
+};
+
Raw_Dynamic_Array :: struct #ordered {
data: rawptr,
count: int,
@@ -360,6 +375,11 @@ __dynamic_array_append :: proc(array_: rawptr, elem_size, elem_align: int,
items: rawptr, item_count: int) -> int {
array := cast(^Raw_Dynamic_Array)array_;
+ if item_count <= 0 || items == nil {
+ return array.count;
+ }
+
+
ok := true;
if array.capacity <= array.count+item_count {
capacity := 2 * array.capacity + max(8, item_count);
diff --git a/core/utf8.odin b/core/utf8.odin
index 8720e1f20..d1798547d 100644
--- a/core/utf8.odin
+++ b/core/utf8.odin
@@ -30,7 +30,7 @@ HICB :: 0b1011_1111;
Accept_Range :: struct { lo, hi: u8 }
-immutable accept_ranges := [5]Accept_Range{
+accept_ranges := [5]Accept_Range{
{0x80, 0xbf},
{0xa0, 0xbf},
{0x80, 0x9f},
@@ -38,7 +38,7 @@ immutable accept_ranges := [5]Accept_Range{
{0x80, 0x8f},
};
-immutable accept_sizes := [256]byte{
+accept_sizes := [256]byte{
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, // 0x00-0x0f
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, // 0x10-0x1f
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, // 0x20-0x2f