X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftv%2Fstrcalc.c;h=6a6e61231bc3e69b54a120c980697a6b8b3cfb37;hb=f8ead9acbe48af00885e64a6f2f895d1b6cae434;hp=1f77823c9c6d6dc65804261b24247031896e1539;hpb=5244f95767968d8b59ef3f2031612b86474e2455;p=libfirm diff --git a/ir/tv/strcalc.c b/ir/tv/strcalc.c index 1f77823c9..6a6e61231 100644 --- a/ir/tv/strcalc.c +++ b/ir/tv/strcalc.c @@ -22,7 +22,6 @@ * @brief Provides basic mathematical operations on values represented as strings. * @date 2003 * @author Mathias Heil - * @version $Id$ */ #include "config.h" @@ -267,7 +266,7 @@ static char const shrs_table[16][4][2] = { }; /** converting a digit to a binary string */ -static const char *binary_table[16] = { +static char const *const binary_table[] = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" }; @@ -878,7 +877,7 @@ int sc_val_from_str(char sign, unsigned base, const char *str, /* get ready for the next letter */ str++; len--; - } /* while (len > 0 ) */ + } if (sign < 0) do_negate((const char*) buffer, (char*) buffer); @@ -1567,6 +1566,20 @@ void sc_shr(const void *val1, const void *val2, int bitsize, int sign, void *buf sc_shrI(val1, shift_cnt, bitsize, sign, buffer); } +void sc_shrsI(const void *val1, long shift_cnt, int bitsize, int sign, void *buffer) +{ + carry_flag = 0; + + DEBUGPRINTF_COMPUTATION(("%s >>s %ld ", sc_print_hex(value1), shift_cnt)); + do_shr((const char*) val1, calc_buffer, shift_cnt, bitsize, sign, 1); + + DEBUGPRINTF_COMPUTATION(("-> %s\n", sc_print_hex(calc_buffer))); + + if ((buffer != NULL) && (buffer != calc_buffer)) { + memmove(buffer, calc_buffer, calc_buffer_size); + } +} + void sc_shrs(const void *val1, const void *val2, int bitsize, int sign, void *buffer) { long offset = sc_val_to_long(val2);