From c4d2d287fc0eac7348951ce275a1f3d80f25ef3d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 17 Feb 2018 11:54:08 +0000 Subject: #complete switch; Removal of dyncall --- src/exact_value.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/exact_value.cpp') 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)); + } -- cgit v1.2.3