mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 06:49:12 +03:00
AK: Expose the decode_hex_digit helper
This helper is useful on its own for things like uri encoding/decoding, so this commit exposes it via the AK/Hex header
This commit is contained in:
parent
2d58549296
commit
2ab292f381
Notes:
sideshowbarker
2024-07-18 20:22:36 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/2ab292f3811 Pull-request: https://github.com/SerenityOS/serenity/pull/6297 Reviewed-by: https://github.com/linusg
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
static u8 decode_hex_digit(char digit)
|
u8 decode_hex_digit(char digit)
|
||||||
{
|
{
|
||||||
if (digit >= '0' && digit <= '9')
|
if (digit >= '0' && digit <= '9')
|
||||||
return digit - '0';
|
return digit - '0';
|
||||||
|
3
AK/Hex.h
3
AK/Hex.h
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
|
u8 decode_hex_digit(char);
|
||||||
|
|
||||||
Optional<ByteBuffer> decode_hex(const StringView&);
|
Optional<ByteBuffer> decode_hex(const StringView&);
|
||||||
|
|
||||||
String encode_hex(ReadonlyBytes);
|
String encode_hex(ReadonlyBytes);
|
||||||
@ -40,4 +42,5 @@ String encode_hex(ReadonlyBytes);
|
|||||||
}
|
}
|
||||||
|
|
||||||
using AK::decode_hex;
|
using AK::decode_hex;
|
||||||
|
using AK::decode_hex_digit;
|
||||||
using AK::encode_hex;
|
using AK::encode_hex;
|
||||||
|
Loading…
Reference in New Issue
Block a user