/* C-SKY disassembler.
- Copyright (C) 1988-2019 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.
static unsigned int
csky_chars_to_number (unsigned char * buf, int n)
{
- if (n <= 0)
- abort ();
int i;
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;
}