aboutsummaryrefslogtreecommitdiff
path: root/src/fstring.cpp
blob: 429dfef9212df29d8313cea0b35f5fc2b5ce2289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "fstring.h"
#include "hash.h"

template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k )
{
	long j, sz = k.getSize();
	const char *s = k.getStr();

	long nPos = 0;
	for( j = 0; j < sz; j++, s++ )
	{
		nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
	}

	return nPos;
}

template<> bool Bu::__cmpHashKeys<Bu::FString>(
		const Bu::FString &a, const Bu::FString &b )
{
	return a == b;
}

std::basic_ostream<char>& operator<< (std::basic_ostream<char> &os, const Bu::FString &val )
{
	os.write( val.getStr(), val.getSize() );
	return os;
}