summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-31 07:42:44 +0100
committerMatthias Braun <matze@braunis.de>2014-12-31 07:42:44 +0100
commit874898aa31ce0bfd67cd016b4334ff53bdad4ca6 (patch)
tree4bd88bb4c87209619e30c2128e05492b92654acb /ir/tv
parenta9d539da4fd07c2a3b57fe9843197051bcc08c57 (diff)
restrict new_tarval_from_long to two_comeplement modes
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/tv.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/ir/tv/tv.c b/ir/tv/tv.c
index 3782bbf..f315771 100644
--- a/ir/tv/tv.c
+++ b/ir/tv/tv.c
@@ -222,23 +222,10 @@ ir_tarval *new_tarval_from_str(const char *str, size_t len, ir_mode *mode)
ir_tarval *new_tarval_from_long(long l, ir_mode *mode)
{
- switch (get_mode_sort(mode)) {
- case irms_reference:
- case irms_int_number: {
- sc_word *buffer = ALLOCAN(sc_word, sc_value_length);
- sc_val_from_long(l, buffer);
- return get_int_tarval(buffer, mode);
- }
-
- case irms_float_number:
- return new_tarval_from_double((long double)l, mode);
-
- case irms_internal_boolean:
- case irms_data:
- case irms_auxiliary:
- break;
- }
- panic("unsupported mode sort");
+ assert(get_mode_arithmetic(mode) == irma_twos_complement);
+ sc_word *buffer = ALLOCAN(sc_word, sc_value_length);
+ sc_val_from_long(l, buffer);
+ return get_int_tarval(buffer, mode);
}
ir_tarval *new_tarval_nan(ir_mode *mode, int signaling, ir_tarval *payload)