~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/my_hash.cc

  • Committer: Monty Taylor
  • Date: 2011-03-08 06:21:17 UTC
  • mfrom: (2223.1.3 build)
  • Revision ID: mordred@inaugust.com-20110308062117-4i2syq1gqtmcmcyk
Merge Olaf - XID and Dynamic_array refactoring
Merge Andrew - Optimizer bugs

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/my_hash.h>
26
26
#include <drizzled/charset.h>
27
27
#include <drizzled/charset_info.h>
 
28
#include <vector>
28
29
 
29
 
namespace drizzled
30
 
{
 
30
namespace drizzled {
31
31
 
32
32
const uint32_t NO_RECORD= UINT32_MAX;
33
33
 
36
36
const int HIGHFIND= 4;
37
37
const int HIGHUSED= 8;
38
38
 
39
 
typedef struct st_hash_info {
40
 
  /* index to next key */
41
 
  uint32_t next;
42
 
  /* data for current entry */
43
 
  unsigned char *data;
44
 
} HASH_LINK;
45
 
 
46
 
static uint32_t hash_mask(uint32_t hashnr, uint32_t buffmax,
47
 
                          uint32_t maxlength);
48
 
static void movelink(HASH_LINK *array, uint32_t pos,
49
 
                     uint32_t next_link, uint32_t newlink);
50
 
static int hashcmp(const HASH *hash, HASH_LINK *pos, const unsigned char *key,
51
 
                   size_t length);
52
 
 
53
 
static uint32_t calc_hash(const HASH *hash, const unsigned char *key,
54
 
                          size_t length)
 
39
static uint32_t hash_mask(uint32_t hashnr, uint32_t buffmax, uint32_t maxlength);
 
40
static void movelink(HASH_LINK *array, uint32_t pos, uint32_t next_link, uint32_t newlink);
 
41
static int hashcmp(const HASH *hash, HASH_LINK *pos, const unsigned char *key, size_t length);
 
42
 
 
43
static uint32_t calc_hash(const HASH *hash, const unsigned char *key, size_t length)
55
44
{
56
45
  uint32_t nr1=1, nr2=4;
57
46
  hash->charset->coll->hash_sort(hash->charset, key,length, &nr1, &nr2);