libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
StrHash64.h File Reference
#include <stdint.h>
Include dependency graph for StrHash64.h:

Go to the source code of this file.

Macros

#define INITIAL_CRC64   0xffffffffffffffffULL
 Initial CRC64 seed value. Pass to update_crc64() as the starting crc.
 

Functions

uint64_t update_crc64 (const void *buf, uint32_t len, uint64_t crc)
 Updates a running CRC64 checksum with len bytes from buf.
 
uint64_t crc64 (const void *buf, uint32_t len)
 Computes the CRC64 of len bytes starting at buf.
 
uint64_t CRC64 (const char *t)
 Computes the CRC64 of a null-terminated string t.
 

Macro Definition Documentation

◆ INITIAL_CRC64

#define INITIAL_CRC64   0xffffffffffffffffULL

Initial CRC64 seed value. Pass to update_crc64() as the starting crc.

Function Documentation

◆ CRC64()

uint64_t CRC64 ( const char *  t)
extern

Computes the CRC64 of a null-terminated string t.

This is the primary hashing function used by the resource system to map virtual resource paths (char*) to their 64-bit CRC identifiers.

Parameters
tNull-terminated string to hash.
Returns
64-bit CRC hash of t (excluding the null terminator).

◆ crc64()

uint64_t crc64 ( const void *  buf,
uint32_t  len 
)
extern

Computes the CRC64 of len bytes starting at buf.

Equivalent to calling update_crc64() once with INITIAL_CRC64 as the seed.

Parameters
bufPointer to the data to hash.
lenNumber of bytes in buf.
Returns
64-bit CRC hash of the input.

◆ update_crc64()

uint64_t update_crc64 ( const void *  buf,
uint32_t  len,
uint64_t  crc 
)
extern

Updates a running CRC64 checksum with len bytes from buf.

Use this function to compute the CRC64 of a multi-part message by chaining calls:

uint64_t crc = INITIAL_CRC64;
crc = update_crc64(part1, len1, crc);
crc = update_crc64(part2, len2, crc);
uint64_t update_crc64(const void *buf, uint32_t len, uint64_t crc)
Updates a running CRC64 checksum with len bytes from buf.
#define INITIAL_CRC64
Initial CRC64 seed value. Pass to update_crc64() as the starting crc.
Definition StrHash64.h:90
Parameters
bufPointer to the data to hash.
lenNumber of bytes in buf.
crcRunning CRC64 value (initialise with INITIAL_CRC64).
Returns
Updated CRC64 value.