mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 23:16:31 +00:00
Move strhash to string_utils.h
This commit is contained in:
@@ -359,24 +359,6 @@ D3D11DebugManager::~D3D11DebugManager()
|
||||
//////////////////////////////////////////////////////
|
||||
// debug/replay functions
|
||||
|
||||
static uint32_t strhash(const char *str, uint32_t seed = 5381)
|
||||
{
|
||||
if(str == NULL) return seed;
|
||||
|
||||
uint32_t hash = seed;
|
||||
int c = *str;
|
||||
str++;
|
||||
|
||||
while(c)
|
||||
{
|
||||
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
|
||||
c = *str;
|
||||
str++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
string D3D11DebugManager::GetShaderBlob(const char *source, const char *entry, const uint32_t compileFlags, const char *profile, ID3DBlob **srcblob)
|
||||
{
|
||||
uint32_t hash = strhash(source);
|
||||
|
||||
@@ -28,6 +28,24 @@
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
|
||||
uint32_t strhash(const char *str, uint32_t seed)
|
||||
{
|
||||
if(str == NULL) return seed;
|
||||
|
||||
uint32_t hash = seed;
|
||||
int c = *str;
|
||||
str++;
|
||||
|
||||
while(c)
|
||||
{
|
||||
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
|
||||
c = *str;
|
||||
str++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
string strlower(const string& str)
|
||||
{
|
||||
string newstr(str);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using std::string;
|
||||
@@ -35,6 +36,8 @@ std::wstring strlower(const std::wstring& str);
|
||||
std::string strupper(const std::string& str);
|
||||
std::wstring strupper(const std::wstring& str);
|
||||
|
||||
uint32_t strhash(const char *str, uint32_t existingHash = 5381);
|
||||
|
||||
template<class strType> strType basename(const strType &path)
|
||||
{
|
||||
strType base = path;
|
||||
|
||||
Reference in New Issue
Block a user