# fix portability problem with the Hsieh hash, which I had introduced accidentially.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@964 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2011-04-22 17:14:21 +00:00
parent 07dd50c975
commit 7807c15e65
2 changed files with 11 additions and 6 deletions

View File

@ -42,9 +42,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_HASH_H_INCLUDED #define AI_HASH_H_INCLUDED
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// hashing function taken from // Hashing function taken from
// http://www.azillionmonkeys.com/qed/hash.html // http://www.azillionmonkeys.com/qed/hash.html
// (incremental version of the hashing function) // (incremental version)
//
// This code is Copyright 2004-2008 by Paul Hsieh. It is used here in the belief that
// Assimp's license is considered compatible with Pauls's derivative license as specified
// on his web page.
//
// (stdint.h should have been been included here) // (stdint.h should have been been included here)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#undef get16bits #undef get16bits
@ -59,12 +64,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif #endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
inline unsigned int SuperFastHash (const char * data, unsigned int len = 0, unsigned int hash = 0) { inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) {
unsigned int tmp; uint32_t tmp;
int rem; int rem;
if (!data) return 0; if (!data) return 0;
if (!len)len = (unsigned int)::strlen(data); if (!len)len = (uint32_t)::strlen(data);
rem = len & 3; rem = len & 3;
len >>= 2; len >>= 2;

View File

@ -416,7 +416,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
unsigned int processed = 0; unsigned int processed = 0;
for (unsigned int job;job = std::min(mesh->mNumFaces-processed,512u);processed += job) { for (unsigned int job;job = std::min(mesh->mNumFaces-processed,512u);processed += job) {
unsigned int hash = 0; uint32_t hash = 0;
for (unsigned int a = 0; a < job;++a) { for (unsigned int a = 0; a < job;++a) {
const aiFace& f = mesh->mFaces[processed+a]; const aiFace& f = mesh->mFaces[processed+a];