1
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
21
#include "myisampack.h"
23
typedef struct st_HA_KEYSEG /* Key-portion */
25
CHARSET_INFO *charset;
26
uint32 start; /* Start of key in record */
27
uint32 null_pos; /* position to NULL indicator */
28
uint16 bit_pos; /* Position to bit part */
30
uint16 length; /* Keylength */
31
uint8 type; /* Type of key (for sort) */
33
uint8 null_bit; /* bitmask to test for NULL */
34
uint8 bit_start,bit_end; /* if bit field */
35
uint8 bit_length; /* Length of bit part */
38
#define get_key_length(length,key) \
39
{ if ((uchar) *(key) != 255) \
40
length= (uint) (uchar) *((key)++); \
42
{ length=mi_uint2korr((key)+1); (key)+=3; } \
45
#define get_key_length_rdonly(length,key) \
46
{ if ((uchar) *(key) != 255) \
47
length= ((uint) (uchar) *((key))); \
49
{ length=mi_uint2korr((key)+1); } \
52
#define get_key_pack_length(length,length_pack,key) \
53
{ if ((uchar) *(key) != 255) \
54
{ length= (uint) (uchar) *((key)++); length_pack=1; }\
56
{ length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
59
#define store_key_length_inc(key,length) \
60
{ if ((length) < 255) \
61
{ *(key)++=(length); } \
63
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
66
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
67
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
68
((1 << (bit_len)) - 1))
70
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
72
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
73
((bits) << (bit_ofs)); \
74
if ((bit_ofs) + (bit_len) > 8) \
75
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
76
((bits) >> (8 - (bit_ofs))); \
79
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
80
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
82
extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
84
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
85
register uchar *b, uint key_length, uint nextflag,
89
#endif /* _my_compare_h */