chore(string): tidy up code style in CStringManager

This commit is contained in:
fallenoak 2022-12-26 16:41:38 -06:00
parent 69a95ae405
commit f395a2dc9d
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
2 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,5 @@
#include "common/string/CStringManager.hpp"
#include <climits>
#include <cstdlib>
#include <cstring>
#include <storm/Memory.hpp>
#include <storm/String.hpp>
@ -23,8 +22,8 @@ CStringManager::CStringManager() {
}
char* CStringManager::Add(const char* str) {
uint32_t hashval = SStrHashHT(str);
uint32_t bucketIdx = hashval % 0x209;
auto hashval = SStrHashHT(str);
auto bucketIdx = hashval % C_STRING_MANAGER_BUCKETS;
auto bucket = this->m_buckets[bucketIdx];
if (bucket) {

View file

@ -3,6 +3,8 @@
#include "common/string/CStringMemory.hpp"
#define C_STRING_MANAGER_BUCKETS 521
struct CStringElement;
class CStringManager {
@ -14,7 +16,7 @@ class CStringManager {
static CStringManager* Get();
// Member variables
CStringElement* m_buckets[521];
CStringElement* m_buckets[C_STRING_MANAGER_BUCKETS];
CStringMemory m_memory;
// Member functions