"What's important is not to win, but to beat Finland."
- Swedish proverb
More pages: 1 ... 11 ... 21 ... 31 ... 41 ... 51 ... 61 ... 71 ... 81 ... 91 ... 101 ... 111 ... 121 ... 131 ... 134 135 136 137 138 139 140 141 142 143 144 ... 151 ... 161 ... 171 ... 181 ... 191 ... 201 ... 211 ... 221 ... 231 ... 241 ... 251 ... 261 ... 271 ... 281 ... 291 ... 301 ... 311 ... 321 ... 331 ... 341 ... 351 ... 361 ... 371 ... 381 ... 391 ... 401 ... 411 ... 421 ... 431 ... 438
Query FailedReavenk
Saturday, May 22, 2010

Agh! I can't beleive you didn't make a reference to Google's doodle of the day. It's a pacman level that spells Google, that you can actually play! It's got cutscenes and everything.

rebb
Friday, May 21, 2010

Your other project was growing an extra set of hands ?

Well done !

Oh wait.. Congrats

Aslan Dzodzikov
Monday, May 17, 2010

Just a test result for StringHash:

void PrintHash(const StringHash& _hash)
{
printf( "%x", (unsigned)_hash );
}

PrintHash("Creating Device! Just a test for StringHash";

compiles to:
lea eax, DWORD PTR $T107665[esp+684]
push edi
push eax
mov DWORD PTR $T107665[esp+692], 1584422291 ; 5e705d93H
call ?PrintHash@@YAXABVStringHash@@@Z ; PrintHash
add esp, 4

Under MSVC 2008 SP1

Aslan Dzodzikov
Friday, May 14, 2010

And now the final, more compact version:

class StringHash
{
unsigned m_val;

template<size_t N> unsigned _Hash(const char (&str)[N])
{
typedef const char (&truncated_str)[N-1];
return str[N-1] + 65599 * _Hash((truncated_str)str);
}
unsigned _Hash(const char (&str)[2]) { return str[1] + 65599 * str[0]; }

public:
template <size_t N> StringHash(const char (&str)[N]) { m_val = _Hash(str); }
operator unsigned() { return m_val; }
};

I apologize for multiple, redundant posts.

Aslan Dzodzikov
Friday, May 14, 2010

Sorry, the previous post contained 1 bug. Here is corrected code:

namespace StringHashHelper
{
template<size_t N>
inline unsigned _Hash(const char (&str)[N])
{
typedef const char (&truncated_str)[N-1];
return str[N-1] + 65599 * _Hash<N-1>((truncated_str)str);
}

template<>
inline unsigned _Hash<1>(const char (&str)[1])
{
return str[0];
}
};

class StringHash
{
unsigned m_val;

public:
template <size_t N>
StringHash(const char (&str)[N])
{
m_val = StringHashHelper::_Hash(str);
}

operator unsigned() { return m_val; }
};

StringHash a = "a", ab = "ab";

Aslan Dzodzikov
Friday, May 14, 2010

It is possible to create just one templated constructor:

namespace StringHashHelper
{
template<size_t N>
unsigned _Hash(const char (&str)[N])
{
typedef const char (&truncated_str)[N-1];
return str[N] + 65599 * _Hash<N-1>((truncated_str)str);
}

template<>
unsigned _Hash<1>(const char (&str)[1])
{
return str[0];
}
};

class StringHash
{
unsigned m_val;

public:
template <size_t N>
StringHash(const char (&str)[N])
{
m_val = StringHashHelper::_Hash(str);
}

operator unsigned() { return m_val; }
};

StringHash a = "a", ab = "ab";

This implementation guaranties loop unrolling.

Aslan Dzodzikov
Friday, May 14, 2010

I have noticed similar inefficiency in MSVC 2008 SP1 - it doesn't eliminate dead code in very obvious case of auto_ptr copy.

ocsi
Thursday, May 13, 2010

DrBalthar: NVIDIAs bigest problem is the system integration era. You know the AMD Fusion is comming, and Intel already have an IGP in their CPU-s. With out an x86 license they don't able to follow this path, so they lost millions of costumer, and billions of money.
The property business model is a way to survive. They cut out the competition in a little segment of the PC market.

More pages: 1 ... 11 ... 21 ... 31 ... 41 ... 51 ... 61 ... 71 ... 81 ... 91 ... 101 ... 111 ... 121 ... 131 ... 134 135 136 137 138 139 140 141 142 143 144 ... 151 ... 161 ... 171 ... 181 ... 191 ... 201 ... 211 ... 221 ... 231 ... 241 ... 251 ... 261 ... 271 ... 281 ... 291 ... 301 ... 311 ... 321 ... 331 ... 341 ... 351 ... 361 ... 371 ... 381 ... 391 ... 401 ... 411 ... 421 ... 431 ... 438