From 9f65bc692058b46efc06a69e8f33bf2a5fd5e4cc Mon Sep 17 00:00:00 2001 From: wangbo Date: Fri, 27 Dec 2013 09:32:34 +0800 Subject: [PATCH] update _type_hash. --- src/cstl_types_aux.c | 2 +- test/ut/ut_cstl_types_aux.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cstl_types_aux.c b/src/cstl_types_aux.c index 5fa653d2..890d88c3 100644 --- a/src/cstl_types_aux.c +++ b/src/cstl_types_aux.c @@ -143,7 +143,7 @@ size_t _type_hash(const char* s_typename) t_hash = t_hash * _TYPE_HASH_BKDR_SEED + (*s_typename++); } - return (t_hash & 0x7fffffff) % _TYPE_REGISTER_BUCKET_COUNT; + return t_hash % _TYPE_REGISTER_BUCKET_COUNT; } /** diff --git a/test/ut/ut_cstl_types_aux.c b/test/ut/ut_cstl_types_aux.c index 69fbe69b..5fdb4291 100644 --- a/test/ut/ut_cstl_types_aux.c +++ b/test/ut/ut_cstl_types_aux.c @@ -50,7 +50,7 @@ void test__type_hash__equalto_bucketcount(void** state) void test__type_hash__greaterthan_bucketcount(void** state) { - assert_true(_type_hash("abcabcabcabcabc") == 118); + assert_true(_type_hash("abcdefghijklmnopqrstuvwxyzz") == 278); } #define TEST__TYPE_REGISTER_BEGIN()\