1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
7 extern const char hex_asc
[];
8 #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
9 #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
11 static inline char *hex_byte_pack(char *buf
, u8 byte
)
13 *buf
++ = hex_asc_hi(byte
);
14 *buf
++ = hex_asc_lo(byte
);
18 extern const char hex_asc_upper
[];
19 #define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
20 #define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
22 static inline char *hex_byte_pack_upper(char *buf
, u8 byte
)
24 *buf
++ = hex_asc_upper_hi(byte
);
25 *buf
++ = hex_asc_upper_lo(byte
);
29 extern int hex_to_bin(unsigned char ch
);
30 extern int __must_check
hex2bin(u8
*dst
, const char *src
, size_t count
);
31 extern char *bin2hex(char *dst
, const void *src
, size_t count
);
33 bool mac_pton(const char *s
, u8
*mac
);