Messages in this thread | | | From | OGAWA Hirofumi <> | Subject | Re: [PATCHv3] fat: don't use custom hex_to_bin() | Date | Thu, 29 Sep 2011 23:51:53 +0900 |
| |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> + /* The ip contains 2 bytes in little > + * endian format. We need to get them > + * in native endian. */ > + > + rc = hex2bin(op++, ip + 3, 1); > + if (rc < 0) > + return -EINVAL; > + > + rc = hex2bin(op++, ip + 1, 1); > + if (rc < 0) > return -EINVAL; > - } > - *op++ = ec & 0xFF; > - *op++ = ec >> 8; > +
It will not work for big endian arch correctly like original code.
"ip" is made like following,
if (uni_xlate == 1) { *op++ = ':'; op = pack_hex_byte(op, ec >> 8); op = pack_hex_byte(op, ec); len -= 5; } else {
Maybe, my explanation was not good. Like above, "ip" format is like ":1234" (can say big endian, it's the string though), so, this code made a unicode char (op) as little endian.
Thanks. -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
| |