sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGLHashAlgorithm

see header file

(no source file, everything inside header)

class SGLHashAlgorithm;

part of SGEXTN module SG_Containers

Implementation of 32bit WyHash for hash tables

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGLHashAlgorithm.h›

CMake target for BuildLah: SGEXTN::SG_Containers

see this link for more information about BuildLah

parent class: (none)

children classes: (none)

static member functions

static int wyHash32(const SGLSpan‹const unsigned char›& span);

Detailed Description

SGLHashAlgorithm implements 32bit WyHash for a SGLSpan of const unsigned char. WyHash is a high quality hashing algorithm for producing hash tables with minimal hash collision. SGLHashAlgorithm allows you to implement WyHash for your custom structs so that they can be used with SGLHash. This is a template based class with no separate source file.

Implementation Details

SGLHashAlgorithm implements 32bit WyHash as a static function. The implementation is placed in the header file to allow easier access to the WyHash source code.

static int wyHash32(const SGLSpan‹const unsigned char›& span);

Returns a int corresponding to the WyHash output from span.

For convenience, the functions returns a int not a unsigned int. These are effectively the same.

Check the source code of any SGEXTN struct (SGXChar, SGXString, SGXColourRGBA, SGXColourHSLA, SGXIdentifier, SGXTimeStamp, SGXVector2) to see how to implement hash() using this function.

Due to padding, attempting to hash the entire memory of custom structs is undefined behaviour. Instead hash only the defined fields.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects