mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
cc4b3cbacc
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
37 lines
709 B
C++
37 lines
709 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
#include <AK/ByteString.h>
|
|
#include <AK/Error.h>
|
|
#include <AK/StringView.h>
|
|
|
|
namespace AK {
|
|
|
|
constexpr u8 decode_hex_digit(char digit)
|
|
{
|
|
if (digit >= '0' && digit <= '9')
|
|
return digit - '0';
|
|
if (digit >= 'a' && digit <= 'f')
|
|
return 10 + (digit - 'a');
|
|
if (digit >= 'A' && digit <= 'F')
|
|
return 10 + (digit - 'A');
|
|
return 255;
|
|
}
|
|
|
|
ErrorOr<ByteBuffer> decode_hex(StringView);
|
|
|
|
ByteString encode_hex(ReadonlyBytes);
|
|
|
|
}
|
|
|
|
#if USING_AK_GLOBALLY
|
|
using AK::decode_hex;
|
|
using AK::decode_hex_digit;
|
|
using AK::encode_hex;
|
|
#endif
|