X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftv%2Fstrcalc.c;h=98e41ce4216ed69c585d23724886c9785aa1b25e;hb=7498ed3766f3f98604d96d1b75978a3a9e6768ed;hp=47c9475706a22dea2ede4bb3cca6839ebec83bb7;hpb=6437e6f69191e22e7a567c263c32c2f19891996a;p=libfirm diff --git a/ir/tv/strcalc.c b/ir/tv/strcalc.c index 47c947570..98e41ce42 100644 --- a/ir/tv/strcalc.c +++ b/ir/tv/strcalc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -1309,8 +1309,8 @@ unsigned char sc_sub_bits(const void *value, int len, unsigned byte_ofs) { res |= _val(val[nibble_ofs + 1]) << 4; /* kick bits outsize */ - if (len < (int) (8*byte_ofs)) { - res &= 0xFF >> (8*byte_ofs - len); + if (len - 8 * byte_ofs < 8) { + res &= (1 << (len - 8 * byte_ofs)) - 1; } return res; }