fix more cparser warnings, cleanup some libcore code
[libfirm] / ir / ir / irmode.c
index 5cf574f..225f3ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -90,8 +90,8 @@ static inline int modes_are_equal(const ir_mode *m, const ir_mode *n)
  */
 static ir_mode *find_mode(const ir_mode *m)
 {
-       int i;
-       for (i = ARR_LEN(mode_list) - 1; i >= 0; --i) {
+       size_t i, n_modes;
+       for (i = 0, n_modes = ARR_LEN(mode_list); i < n_modes; ++i) {
                ir_mode *n = mode_list[i];
                if (modes_are_equal(n, m))
                        return n;
@@ -567,7 +567,6 @@ int smaller_mode(const ir_mode *sm, const ir_mode *lm)
                                }
                                return sm_bits <= lm_bits;
                        }
-                       break;
 
                case irms_float_number:
                        /* int to float works if the float is large enough */
@@ -605,7 +604,6 @@ int smaller_mode(const ir_mode *sm, const ir_mode *lm)
    and backwards without loss. */
 int values_in_mode(const ir_mode *sm, const ir_mode *lm)
 {
-       int sm_bits, lm_bits;
        ir_mode_arithmetic arith;
 
        assert(sm);
@@ -616,9 +614,6 @@ int values_in_mode(const ir_mode *sm, const ir_mode *lm)
        if (sm == mode_b)
                return mode_is_int(lm);
 
-       sm_bits = get_mode_size_bits(sm);
-       lm_bits = get_mode_size_bits(lm);
-
        arith = get_mode_arithmetic(sm);
        if (arith != get_mode_arithmetic(lm))
                return 0;