add nilptrs, more conversion functions and change how ptrs work
Pointers now no longer point to the Value struct (the internal wrapper for values) but to the value itself.
This commit is contained in:
1 parent
befce544e7
commit
ba8d2f0702
5 files changed
+51
-10
No files matched your search
@@ -130,9 +130,12 @@ Value eval_unary(IRInstr instr, const Value *v) {
|
||||
|
||||
bool is_nonzero(const Value *v) {
|
||||
switch (v->type) {
|
||||
case TypeInt: return v->Int != 0;
|
||||
case TypeFloat: return v->Float != 0.0;
|
||||
case TypeInt: return v->Int != 0;
|
||||
case TypeFloat: return v->Float != 0.0;
|
||||
case TypeBool: return v->Bool;
|
||||
case TypeChar: return v->Char != 0;
|
||||
case TypePtr: return v->Ptr.val != NULL;
|
||||
case TypeArr: return v->Arr.len != 0;
|
||||
default: ASSERT_UNREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user