net/sunrpc/cache: simplify code by using hex_pack_byte()
hex_pack_byte() is a fast way to convert a byte in its ASCII representation. We may use it instead of custom approach. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
a0ef5e1968
commit
056785ea51
1 changed files with 1 additions and 3 deletions
|
@ -1111,9 +1111,7 @@ void qword_addhex(char **bpp, int *lp, char *buf, int blen)
|
||||||
*bp++ = 'x';
|
*bp++ = 'x';
|
||||||
len -= 2;
|
len -= 2;
|
||||||
while (blen && len >= 2) {
|
while (blen && len >= 2) {
|
||||||
unsigned char c = *buf++;
|
bp = hex_byte_pack(bp, *buf++);
|
||||||
*bp++ = '0' + ((c&0xf0)>>4) + (c>=0xa0)*('a'-'9'-1);
|
|
||||||
*bp++ = '0' + (c&0x0f) + ((c&0x0f)>=0x0a)*('a'-'9'-1);
|
|
||||||
len -= 2;
|
len -= 2;
|
||||||
blen--;
|
blen--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue