ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
hex.h File Reference

Base-16 conversion between raw bytes and their ASCII digits. More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  HexStorage
 The two digit tables: the only thing this module owns. More...
 
struct  HexArgs
 What a digit conversion names: one nibble, or one character. More...
 
struct  HexIoArgs
 The buffers a run conversion moves between. More...
 
struct  HexVars
 
struct  HexNs
 The entries. More...
 

Functions

void protocore_hex_digit (uint8_t *work)
 
void protocore_hex_val (uint8_t *work)
 
void protocore_hex_u32 (uint8_t *work)
 
void protocore_hex_encode (uint8_t *work)
 
void protocore_hex_decode (uint8_t *work)
 

Variables

const HexStorage PROTOCORE_HEX
 The digit tables every hex site reads.
 
HexVars HexV
 The operands and the outcome.
 

Detailed Description

Base-16 conversion between raw bytes and their ASCII digits.

Four operations cover every hex site in the library: one nibble out, one digit in, a machine word out, and a byte run in either direction. Each writes into a caller-owned buffer, takes no heap and no <stdlib.h>, and is inline so an unused one costs nothing.

The decoders report failure through a negative return rather than a sentinel digit, so a malformed byte can never be mistaken for a valid zero.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file hex.h.

Function Documentation

◆ protocore_hex_digit()

void protocore_hex_digit ( uint8_t *  work)

◆ protocore_hex_val()

void protocore_hex_val ( uint8_t *  work)

◆ protocore_hex_u32()

void protocore_hex_u32 ( uint8_t *  work)

◆ protocore_hex_encode()

void protocore_hex_encode ( uint8_t *  work)

◆ protocore_hex_decode()

void protocore_hex_decode ( uint8_t *  work)

Variable Documentation

◆ PROTOCORE_HEX

const HexStorage PROTOCORE_HEX
extern

The digit tables every hex site reads.

◆ HexV

HexVars HexV
extern

The operands and the outcome.