X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fcsky-dis.c;h=bc6820ae0765f0e1404d189811c7008dd98bc9e8;hb=6d350754a32007465f9adbc11b87339e4493b358;hp=f57b9da6bdba1e1ae193398586077abfc3f5039a;hpb=2d5d5a8f0a8b5a03454bf168b7fa7024bb1ebbd8;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c index f57b9da6bd..bc6820ae07 100644 --- a/opcodes/csky-dis.c +++ b/opcodes/csky-dis.c @@ -1,5 +1,5 @@ /* C-SKY disassembler. - Copyright (C) 1988-2018 Free Software Foundation, Inc. + Copyright (C) 1988-2020 Free Software Foundation, Inc. Contributed by C-SKY Microsystems and Mentor Graphics. This file is part of the GNU opcodes library. @@ -134,17 +134,15 @@ csky_get_mask (struct csky_opcode_info const *pinfo) static unsigned int csky_chars_to_number (unsigned char * buf, int n) { - if (n == 0) - abort (); int i; - int val = 0; + unsigned int val = 0; if (dis_info.info->endian == BFD_ENDIAN_BIG) - while (n--) - val |= buf[n] << (n*8); - else for (i = 0; i < n; i++) - val |= buf[i] << (i*8); + val = val << 8 | buf[i]; + else + for (i = n - 1; i >= 0; i--) + val = val << 8 | buf[i]; return val; }