libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
Typedefs | Functions
hash.h File Reference

Hashing and equality functions for common data types. More...

#include "def.h"

Go to the source code of this file.

Typedefs

typedef u64 hash_t
 Numeric type for hashes.
 
typedef u64(* hasher_t) (void *)
 Function that hashes an object.
 
typedef bool(* is_equal_t) (void *, void *)
 Function that compares whether two objects are equal.
 

Functions

hash_t ps_str_hash (STR str)
 Hashes the given string according to the FNV-1a algorithm.
 
bool ps_str_is_equal (STR a, STR b)
 Compares the given strings.
 

Detailed Description

Hashing and equality functions for common data types.

Author
Ethan Uppal

Definition in file hash.h.

Typedef Documentation

◆ hash_t

typedef u64 hash_t

Numeric type for hashes.

Definition at line 12 of file hash.h.

◆ hasher_t

typedef u64(* hasher_t) (void *)

Function that hashes an object.

Definition at line 15 of file hash.h.

◆ is_equal_t

typedef bool(* is_equal_t) (void *, void *)

Function that compares whether two objects are equal.

Definition at line 18 of file hash.h.

Function Documentation

◆ ps_str_hash()

hash_t ps_str_hash ( STR  str)

Hashes the given string according to the FNV-1a algorithm.

Parameters
strThe string to hash.

Definition at line 12 of file hash.c.

◆ ps_str_is_equal()

bool ps_str_is_equal ( STR  a,
STR  b 
)

Compares the given strings.

Parameters
aThe first string.
bThe second string.
Returns
True if the strings are equal, false otherwise.

Definition at line 21 of file hash.c.