Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
59d6e489
Commit
59d6e489
authored
May 04, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
count_bits() moved to mysys/
parent
cd0f4083
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
43 deletions
+45
-43
include/my_sys.h
include/my_sys.h
+1
-0
mysys/my_bit.c
mysys/my_bit.c
+42
-0
sql/item_func.cc
sql/item_func.cc
+2
-43
No files found.
include/my_sys.h
View file @
59d6e489
...
@@ -749,6 +749,7 @@ extern my_bool my_uncompress(byte *, ulong *, ulong *);
...
@@ -749,6 +749,7 @@ extern my_bool my_uncompress(byte *, ulong *, ulong *);
extern
byte
*
my_compress_alloc
(
const
byte
*
packet
,
ulong
*
len
,
ulong
*
complen
);
extern
byte
*
my_compress_alloc
(
const
byte
*
packet
,
ulong
*
len
,
ulong
*
complen
);
extern
ulong
checksum
(
const
byte
*
mem
,
uint
count
);
extern
ulong
checksum
(
const
byte
*
mem
,
uint
count
);
extern
uint
my_bit_log2
(
ulong
value
);
extern
uint
my_bit_log2
(
ulong
value
);
uint
my_count_bits
(
ulonglong
v
);
extern
void
my_sleep
(
ulong
m_seconds
);
extern
void
my_sleep
(
ulong
m_seconds
);
#ifdef __WIN__
#ifdef __WIN__
...
...
mysys/my_bit.c
View file @
59d6e489
...
@@ -29,3 +29,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
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
5
,
6
,
6
,
7
,
6
,
7
,
7
,
8
,
};
uint
my_count_bits
(
ulonglong
v
)
{
#if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would
only shift v */
ulong
v2
=
(
ulong
)
(
v
>>
32
);
return
(
uint
)
(
uchar
)
(
nbits
[(
uchar
)
v
]
+
nbits
[(
uchar
)
(
v
>>
8
)]
+
nbits
[(
uchar
)
(
v
>>
16
)]
+
nbits
[(
uchar
)
(
v
>>
24
)]
+
nbits
[(
uchar
)
(
v2
)]
+
nbits
[(
uchar
)
(
v2
>>
8
)]
+
nbits
[(
uchar
)
(
v2
>>
16
)]
+
nbits
[(
uchar
)
(
v2
>>
24
)]);
#else
return
(
uint
)
(
uchar
)
(
nbits
[(
uchar
)
v
]
+
nbits
[(
uchar
)
(
v
>>
8
)]
+
nbits
[(
uchar
)
(
v
>>
16
)]
+
nbits
[(
uchar
)
(
v
>>
24
)]);
#endif
}
sql/item_func.cc
View file @
59d6e489
...
@@ -1110,47 +1110,6 @@ longlong Item_func_find_in_set::val_int()
...
@@ -1110,47 +1110,6 @@ longlong Item_func_find_in_set::val_int()
return
0
;
return
0
;
}
}
static
char
nbits
[
256
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
3
,
4
,
4
,
5
,
4
,
5
,
5
,
6
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
4
,
5
,
5
,
6
,
5
,
6
,
6
,
7
,
5
,
6
,
6
,
7
,
6
,
7
,
7
,
8
,
};
uint
count_bits
(
ulonglong
v
)
{
#if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would
only shift v */
ulong
v2
=
(
ulong
)
(
v
>>
32
);
return
(
uint
)
(
uchar
)
(
nbits
[(
uchar
)
v
]
+
nbits
[(
uchar
)
(
v
>>
8
)]
+
nbits
[(
uchar
)
(
v
>>
16
)]
+
nbits
[(
uchar
)
(
v
>>
24
)]
+
nbits
[(
uchar
)
(
v2
)]
+
nbits
[(
uchar
)
(
v2
>>
8
)]
+
nbits
[(
uchar
)
(
v2
>>
16
)]
+
nbits
[(
uchar
)
(
v2
>>
24
)]);
#else
return
(
uint
)
(
uchar
)
(
nbits
[(
uchar
)
v
]
+
nbits
[(
uchar
)
(
v
>>
8
)]
+
nbits
[(
uchar
)
(
v
>>
16
)]
+
nbits
[(
uchar
)
(
v
>>
24
)]);
#endif
}
longlong
Item_func_bit_count
::
val_int
()
longlong
Item_func_bit_count
::
val_int
()
{
{
ulonglong
value
=
(
ulonglong
)
args
[
0
]
->
val_int
();
ulonglong
value
=
(
ulonglong
)
args
[
0
]
->
val_int
();
...
@@ -1159,7 +1118,7 @@ longlong Item_func_bit_count::val_int()
...
@@ -1159,7 +1118,7 @@ longlong Item_func_bit_count::val_int()
null_value
=
1
;
/* purecov: inspected */
null_value
=
1
;
/* purecov: inspected */
return
0
;
/* purecov: inspected */
return
0
;
/* purecov: inspected */
}
}
return
(
longlong
)
count_bits
(
value
);
return
(
longlong
)
my_
count_bits
(
value
);
}
}
...
@@ -2221,7 +2180,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
...
@@ -2221,7 +2180,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
used_tables_cache
|=
item
->
used_tables
();
used_tables_cache
|=
item
->
used_tables
();
}
}
/* check that all columns come from the same table */
/* check that all columns come from the same table */
if
(
count_bits
(
used_tables_cache
)
!=
1
)
if
(
my_
count_bits
(
used_tables_cache
)
!=
1
)
key
=
NO_SUCH_KEY
;
key
=
NO_SUCH_KEY
;
const_item_cache
=
0
;
const_item_cache
=
0
;
table
=
((
Item_field
*
)
fields
.
head
())
->
field
->
table
;
table
=
((
Item_field
*
)
fields
.
head
())
->
field
->
table
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment