gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
ui::hash32::hash32gen< size, idx, dummy > Struct Template Reference

A compile-time CRC32 hash function. More...

#include <id.hpp>

Static Public Member Functions

static constexpr id_t crc32 (const char *str, id_t prev_crc=0xFFFFFFFF)
 Computes the CRC32 hash of a string at compile time.
 

Detailed Description

template<int size, int idx = 0, class dummy = void>
struct ui::hash32::hash32gen< size, idx, dummy >

A compile-time CRC32 hash function.

This template recursively computes the CRC32 hash of a string at compile time. To use this, call constexpr auto your_var = HASH32("your_string") with a string literal. It will also work with strings that aren't known at compile time, but the result will of course be computed at runtime.

Member Function Documentation

◆ crc32()

template<int size, int idx = 0, class dummy = void>
static constexpr id_t ui::hash32::hash32gen< size, idx, dummy >::crc32 ( const char *  str,
id_t  prev_crc = 0xFFFFFFFF 
)
inlinestaticconstexpr

Computes the CRC32 hash of a string at compile time.

Parameters
strThe string to hash.
prev_crcThe previous CRC value, default is 0xFFFFFFFF.
Returns
The computed CRC32 hash.

The documentation for this struct was generated from the following file: