diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-17 11:54:08 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-17 11:54:08 +0000 |
| commit | c4d2d287fc0eac7348951ce275a1f3d80f25ef3d (patch) | |
| tree | e082b0f1d744689ced0cdab73dd405981cacbf3a /src/exact_value.cpp | |
| parent | 6a85546b761b67fa012a2cd49e32b2211bf02971 (diff) | |
#complete switch; Removal of dyncall
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index c1666cafd..ed181b9d0 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -46,7 +46,31 @@ struct ExactValue { gb_global ExactValue const empty_exact_value = {}; HashKey hash_exact_value(ExactValue v) { + switch (v.kind) { + case ExactValue_Invalid: + return HashKey{}; + case ExactValue_Bool: + return hash_integer(u64(v.value_bool)); + case ExactValue_String: + return hash_string(v.value_string); + case ExactValue_Integer: + return hash_integer(u64(v.value_integer)); + case ExactValue_Float: + return hash_f64(v.value_float); + case ExactValue_Pointer: + return hash_integer(v.value_pointer); + case ExactValue_Complex: + return hashing_proc(&v.value_complex, gb_size_of(Complex128)); + + case ExactValue_Compound: + return hash_pointer(v.value_compound); + case ExactValue_Procedure: + return hash_pointer(v.value_procedure); + case ExactValue_Type: + return hash_pointer(v.value_type); + } return hashing_proc(&v, gb_size_of(ExactValue)); + } |