/
githubmirror
/
nvme-cli
Обзор
Документация
Войти
/
githubmirror
/
nvme-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/hex-util.h
21 строка
618 B
Daniel Wagner
shared: move hex_to_int/hex_to_ascii to shared/hex-util
07 авг 2026, 16:15
07 авг 2026, 16:15
e2b572d
Код
Авторство
О чём код?
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * This file is part of nvme-cli. * Copyright (c) Micron, Inc 2024. * * Authors: Chaithanya Shoba <ashoba@micron.com> */ #pragma once /* * Convert a single hexadecimal digit ('0'-'9', 'a'-'f', 'A'-'F') to its * integer value. Return: 0-15, or -1 if c is not a hex digit. */ int shr_hex_to_int(char c); /* * Decode a hex string into the raw bytes it represents. An odd number of * digits is treated as if left-padded with a leading '0'. * Return: a newly allocated buffer (caller must free), or NULL on error. */ char *shr_hex_to_ascii(const char *hex);