libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
z::core::hash32gen< size, idx, dummy > Struct Template Reference

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

#include <hash32.hpp>

Static Public Member Functions

static constexpr hash32 crc32 (const char *str, hash32 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 z::core::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 hash32 z::core::hash32gen< size, idx, dummy >::crc32 ( const char str,
hash32  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: