fixed svn properties
[libfirm] / ir / tv / tv.c
index e4e37da..1aa0dea 100644 (file)
@@ -761,6 +761,15 @@ int tarval_is_all_one(tarval *tv) {
                tv == get_mode_all_one(get_tarval_mode(tv));
 }
 
+/*
+ * test if one, 1 means 'yes'
+ */
+int tarval_is_minus_one(tarval *a) {
+       return
+               a != tarval_bad &&
+               a == get_tarval_minus_one(get_tarval_mode(a));
+}
+
 /*
  * comparison
  */
@@ -875,9 +884,10 @@ tarval *tarval_convert_to(tarval *src, ir_mode *dst_mode) {
                                assert(0);
                                break;
                        }
-                       if (! fc_flt2int(res, sc_get_buffer(), dst_mode))
+                       buffer = alloca(sc_get_buffer_length());
+                       if (! fc_flt2int(res, buffer, dst_mode))
                                return tarval_bad;
-                       return get_tarval(sc_get_buffer(), sc_get_buffer_length(), dst_mode);
+                       return get_tarval(buffer, sc_get_buffer_length(), dst_mode);
 
                default:
                        /* the rest can't be converted */