aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-25 20:05:10 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-25 20:05:10 -0400
commitdb613d38f07da20385709b8250d1a3e83b96337d (patch)
tree5970e02cc586797713da73c5c113147391b45018 /src/ir.cpp
parent4d8269f69f530fe251e3132a95285c0af9d3aaab (diff)
downloadzig-db613d38f07da20385709b8250d1a3e83b96337d.tar.gz
zig-db613d38f07da20385709b8250d1a3e83b96337d.zip
implement comptime bitcasting from array
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index f88612a049..c39950081f 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -14364,7 +14364,16 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
zig_unreachable();
}
case TypeTableEntryIdArray:
- zig_panic("TODO buf_write_value_bytes array type");
+ {
+ size_t buf_i = 0;
+ expand_undef_array(codegen, val);
+ for (size_t elem_i = 0; elem_i < val->type->data.array.len; elem_i += 1) {
+ ConstExprValue *elem = &val->data.x_array.s_none.elements[elem_i];
+ buf_write_value_bytes(codegen, &buf[buf_i], elem);
+ buf_i += type_size(codegen, elem->type);
+ }
+ }
+ return;
case TypeTableEntryIdStruct:
zig_panic("TODO buf_write_value_bytes struct type");
case TypeTableEntryIdMaybe: