~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/ptr_cmp.cc

  • Committer: Monty Taylor
  • Date: 2009-03-08 23:45:12 UTC
  • mto: (923.2.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 921.
  • Revision ID: mordred@inaugust.com-20090308234512-tqkygxtu1iaig23s
Removed C99 isnan() usage, which allows us to remove the util/math.{cc,h} workarounds. Yay for standards!

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/*
17
17
  get_ptr_compare(len) returns a pointer to a optimal byte-compare function
19
19
  The bytes are compare as unsigned chars.
20
20
  */
21
21
 
22
 
#include <config.h>
23
 
#include <drizzled/internal/my_sys.h>
24
 
 
25
 
#include <assert.h>
26
 
 
27
 
#include <plugin/myisam/myisampack.h>
28
 
 
29
 
namespace drizzled
30
 
{
31
 
namespace internal
32
 
{
 
22
#include "mysys_priv.h"
 
23
#include <storage/myisam/myisampack.h>
33
24
 
34
25
static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b);
35
26
static int ptr_compare_0(size_t *compare_length, unsigned char **a, unsigned char **b);
54
45
 
55
46
 
56
47
        /*
57
 
          Compare two keys to see which is smaller.
 
48
          Compare to keys to see witch is smaller.
58
49
          Loop unrolled to make it quick !!
59
50
        */
60
51
 
62
53
 
63
54
static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b)
64
55
{
65
 
  int length= *compare_length;
66
 
  unsigned char *first,*last;
 
56
  register int length= *compare_length;
 
57
  register unsigned char *first,*last;
67
58
 
68
59
  first= *a; last= *b;
69
60
  while (--length)
77
68
 
78
69
static int ptr_compare_0(size_t *compare_length,unsigned char **a, unsigned char **b)
79
70
{
80
 
  int length= *compare_length;
81
 
  unsigned char *first,*last;
 
71
  register int length= *compare_length;
 
72
  register unsigned char *first,*last;
82
73
 
83
74
  first= *a; last= *b;
84
75
 loop:
98
89
 
99
90
static int ptr_compare_1(size_t *compare_length,unsigned char **a, unsigned char **b)
100
91
{
101
 
  int length= *compare_length-1;
102
 
  unsigned char *first,*last;
 
92
  register int length= *compare_length-1;
 
93
  register unsigned char *first,*last;
103
94
 
104
95
  first= *a+1; last= *b+1;
105
96
  cmp(-1);
119
110
 
120
111
static int ptr_compare_2(size_t *compare_length,unsigned char **a, unsigned char **b)
121
112
{
122
 
  int length= *compare_length-2;
123
 
  unsigned char *first,*last;
 
113
  register int length= *compare_length-2;
 
114
  register unsigned char *first,*last;
124
115
 
125
116
  first= *a +2 ; last= *b +2;
126
117
  cmp(-2);
141
132
 
142
133
static int ptr_compare_3(size_t *compare_length,unsigned char **a, unsigned char **b)
143
134
{
144
 
  int length= *compare_length-3;
145
 
  unsigned char *first,*last;
 
135
  register int length= *compare_length-3;
 
136
  register unsigned char *first,*last;
146
137
 
147
138
  first= *a +3 ; last= *b +3;
148
139
  cmp(-3);
199
190
 return pos;
200
191
}
201
192
 
202
 
} /* namespace internal */
203
 
} /* namespace drizzled */