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
7b1aed3f
Commit
7b1aed3f
authored
Aug 09, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
99cb0835
74c71689
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
293 additions
and
52 deletions
+293
-52
client/mysql.cc
client/mysql.cc
+1
-4
mysql-test/r/bigint.result
mysql-test/r/bigint.result
+9
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+117
-0
mysql-test/r/grant.result
mysql-test/r/grant.result
+3
-0
mysql-test/t/bigint.test
mysql-test/t/bigint.test
+3
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+39
-0
mysql-test/t/grant.test
mysql-test/t/grant.test
+7
-0
sql/item.cc
sql/item.cc
+8
-4
sql/item_strfunc.cc
sql/item_strfunc.cc
+14
-2
strings/Makefile.am
strings/Makefile.am
+2
-2
strings/longlong2str-x86.s
strings/longlong2str-x86.s
+18
-17
strings/longlong2str_asm.c
strings/longlong2str_asm.c
+33
-0
strings/my_strtoll10-x86.s
strings/my_strtoll10-x86.s
+39
-23
No files found.
client/mysql.cc
View file @
7b1aed3f
...
...
@@ -1563,11 +1563,8 @@ You can turn off this feature to get a quicker startup with -A\n\n");
mysql_free_result
(
fields
);
}
else
{
tee_fprintf
(
stdout
,
"Didn't find any fields in table '%s'
\n
"
,
table_row
[
0
]);
field_names
[
i
]
=
0
;
}
i
++
;
}
mysql_free_result
(
tables
);
...
...
mysql-test/r/bigint.result
View file @
7b1aed3f
...
...
@@ -17,6 +17,15 @@ select 9223372036854775808+1;
select -(0-3),round(-(0-3)), round(9999999999999999999);
-(0-3) round(-(0-3)) round(9999999999999999999)
3 3 10000000000000000000
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000001
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000000
select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
conv(1,10,16) conv((1<<2)-1,10,16) conv((1<<10)-2,10,16) conv((1<<16)-3,10,16) conv((1<<25)-4,10,16) conv((1<<31)-5,10,16) conv((1<<36)-6,10,16) conv((1<<47)-7,10,16) conv((1<<48)-8,10,16) conv((1<<55)-9,10,16) conv((1<<56)-10,10,16) conv((1<<63)-11,10,16)
1 3 3FE FFFD 1FFFFFC 7FFFFFFB FFFFFFFFA 7FFFFFFFFFF9 FFFFFFFFFFF8 7FFFFFFFFFFFF7 FFFFFFFFFFFFF6 7FFFFFFFFFFFFFF5
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
...
...
mysql-test/r/func_str.result
View file @
7b1aed3f
...
...
@@ -45,6 +45,123 @@ www. .se
select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1);
substring_index('.tcx.se','.',-2) substring_index('.tcx.se','.tcx',-1)
tcx.se .se
select substring_index('aaaaaaaaa1','a',1);
substring_index('aaaaaaaaa1','a',1)
select substring_index('aaaaaaaaa1','aa',1);
substring_index('aaaaaaaaa1','aa',1)
select substring_index('aaaaaaaaa1','aa',2);
substring_index('aaaaaaaaa1','aa',2)
aa
select substring_index('aaaaaaaaa1','aa',3);
substring_index('aaaaaaaaa1','aa',3)
aaaa
select substring_index('aaaaaaaaa1','aa',4);
substring_index('aaaaaaaaa1','aa',4)
aaaaaa
select substring_index('aaaaaaaaa1','aa',5);
substring_index('aaaaaaaaa1','aa',5)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaa',1);
substring_index('aaaaaaaaa1','aaa',1)
select substring_index('aaaaaaaaa1','aaa',2);
substring_index('aaaaaaaaa1','aaa',2)
aaa
select substring_index('aaaaaaaaa1','aaa',3);
substring_index('aaaaaaaaa1','aaa',3)
aaaaaa
select substring_index('aaaaaaaaa1','aaa',4);
substring_index('aaaaaaaaa1','aaa',4)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaaa',1);
substring_index('aaaaaaaaa1','aaaa',1)
select substring_index('aaaaaaaaa1','aaaa',2);
substring_index('aaaaaaaaa1','aaaa',2)
aaaa
select substring_index('aaaaaaaaa1','1',1);
substring_index('aaaaaaaaa1','1',1)
aaaaaaaaa
select substring_index('aaaaaaaaa1','a',-1);
substring_index('aaaaaaaaa1','a',-1)
1
select substring_index('aaaaaaaaa1','aa',-1);
substring_index('aaaaaaaaa1','aa',-1)
1
select substring_index('aaaaaaaaa1','aa',-2);
substring_index('aaaaaaaaa1','aa',-2)
aa1
select substring_index('aaaaaaaaa1','aa',-3);
substring_index('aaaaaaaaa1','aa',-3)
aaaa1
select substring_index('aaaaaaaaa1','aa',-4);
substring_index('aaaaaaaaa1','aa',-4)
aaaaaa1
select substring_index('aaaaaaaaa1','aa',-5);
substring_index('aaaaaaaaa1','aa',-5)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaa',-1);
substring_index('aaaaaaaaa1','aaa',-1)
1
select substring_index('aaaaaaaaa1','aaa',-2);
substring_index('aaaaaaaaa1','aaa',-2)
aaa1
select substring_index('aaaaaaaaa1','aaa',-3);
substring_index('aaaaaaaaa1','aaa',-3)
aaaaaa1
select substring_index('aaaaaaaaa1','aaa',-4);
substring_index('aaaaaaaaa1','aaa',-4)
select substring_index('the king of thethe hill','the',-2);
substring_index('the king of thethe hill','the',-2)
the hill
select substring_index('the king of the the hill','the',-2);
substring_index('the king of the the hill','the',-2)
the hill
select substring_index('the king of the the hill','the',-2);
substring_index('the king of the the hill','the',-2)
the hill
select substring_index('the king of the the hill',' the ',-1);
substring_index('the king of the the hill',' the ',-1)
hill
select substring_index('the king of the the hill',' the ',-2);
substring_index('the king of the the hill',' the ',-2)
the hill
select substring_index('the king of the the hill',' ',-1);
substring_index('the king of the the hill',' ',-1)
hill
select substring_index('the king of the the hill',' ',-2);
substring_index('the king of the the hill',' ',-2)
the hill
select substring_index('the king of the the hill',' ',-3);
substring_index('the king of the the hill',' ',-3)
the hill
select substring_index('the king of the the hill',' ',-4);
substring_index('the king of the the hill',' ',-4)
the the hill
select substring_index('the king of the the hill',' ',-5);
substring_index('the king of the the hill',' ',-5)
of the the hill
select substring_index('the king of the.the hill','the',-2);
substring_index('the king of the.the hill','the',-2)
.the hill
select substring_index('the king of thethethe.the hill','the',-3);
substring_index('the king of thethethe.the hill','the',-3)
the.the hill
select substring_index('the king of thethethe.the hill','the',-1);
substring_index('the king of thethethe.the hill','the',-1)
hill
select substring_index('the king of the the hill','the',1);
substring_index('the king of the the hill','the',1)
select substring_index('the king of the the hill','the',2);
substring_index('the king of the the hill','the',2)
the king of
select substring_index('the king of the the hill','the',3);
substring_index('the king of the the hill','the',3)
the king of the
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
concat(':',ltrim(' left '),':',rtrim(' right '),':')
:left : right:
...
...
mysql-test/r/grant.result
View file @
7b1aed3f
...
...
@@ -440,3 +440,6 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
flush privileges;
delete from tables_priv where host = '' and user = 'mysqltest_1';
flush privileges;
set @user123="non-existent";
select * from mysql.db where user=@user123;
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv
mysql-test/t/bigint.test
View file @
7b1aed3f
...
...
@@ -14,6 +14,9 @@ select +9999999999999999999,-9999999999999999999;
select
cast
(
9223372036854775808
as
unsigned
)
+
1
;
select
9223372036854775808
+
1
;
select
-
(
0
-
3
),
round
(
-
(
0
-
3
)),
round
(
9999999999999999999
);
select
1
,
11
,
101
,
1001
,
10001
,
100001
,
1000001
,
10000001
,
100000001
,
1000000001
,
10000000001
,
100000000001
,
1000000000001
,
10000000000001
,
100000000000001
,
1000000000000001
,
10000000000000001
,
100000000000000001
,
1000000000000000001
,
10000000000000000001
;
select
-
1
,
-
11
,
-
101
,
-
1001
,
-
10001
,
-
100001
,
-
1000001
,
-
10000001
,
-
100000001
,
-
1000000001
,
-
10000000001
,
-
100000000001
,
-
1000000000001
,
-
10000000000001
,
-
100000000000001
,
-
1000000000000001
,
-
10000000000000001
,
-
100000000000000001
,
-
1000000000000000001
,
-
10000000000000000001
;
select
conv
(
1
,
10
,
16
),
conv
((
1
<<
2
)
-
1
,
10
,
16
),
conv
((
1
<<
10
)
-
2
,
10
,
16
),
conv
((
1
<<
16
)
-
3
,
10
,
16
),
conv
((
1
<<
25
)
-
4
,
10
,
16
),
conv
((
1
<<
31
)
-
5
,
10
,
16
),
conv
((
1
<<
36
)
-
6
,
10
,
16
),
conv
((
1
<<
47
)
-
7
,
10
,
16
),
conv
((
1
<<
48
)
-
8
,
10
,
16
),
conv
((
1
<<
55
)
-
9
,
10
,
16
),
conv
((
1
<<
56
)
-
10
,
10
,
16
),
conv
((
1
<<
63
)
-
11
,
10
,
16
);
#
# In 3.23 we have to disable the test of column to bigint as
...
...
mysql-test/t/func_str.test
View file @
7b1aed3f
...
...
@@ -23,6 +23,45 @@ select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',s
select
substring_index
(
'www.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'www.tcx.se'
,
'.'
,
1
);
select
substring_index
(
'www.tcx.se'
,
'tcx'
,
1
),
substring_index
(
'www.tcx.se'
,
'tcx'
,
-
1
);
select
substring_index
(
'.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'.tcx.se'
,
'.tcx'
,
-
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'a'
,
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
2
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
3
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
4
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
5
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
2
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
3
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
4
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaaa'
,
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaaa'
,
2
);
select
substring_index
(
'aaaaaaaaa1'
,
'1'
,
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'a'
,
-
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
-
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
-
2
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
-
3
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
-
4
);
select
substring_index
(
'aaaaaaaaa1'
,
'aa'
,
-
5
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
-
1
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
-
2
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
-
3
);
select
substring_index
(
'aaaaaaaaa1'
,
'aaa'
,
-
4
);
select
substring_index
(
'the king of thethe hill'
,
'the'
,
-
2
);
select
substring_index
(
'the king of the the hill'
,
'the'
,
-
2
);
select
substring_index
(
'the king of the the hill'
,
'the'
,
-
2
);
select
substring_index
(
'the king of the the hill'
,
' the '
,
-
1
);
select
substring_index
(
'the king of the the hill'
,
' the '
,
-
2
);
select
substring_index
(
'the king of the the hill'
,
' '
,
-
1
);
select
substring_index
(
'the king of the the hill'
,
' '
,
-
2
);
select
substring_index
(
'the king of the the hill'
,
' '
,
-
3
);
select
substring_index
(
'the king of the the hill'
,
' '
,
-
4
);
select
substring_index
(
'the king of the the hill'
,
' '
,
-
5
);
select
substring_index
(
'the king of the.the hill'
,
'the'
,
-
2
);
select
substring_index
(
'the king of thethethe.the hill'
,
'the'
,
-
3
);
select
substring_index
(
'the king of thethethe.the hill'
,
'the'
,
-
1
);
select
substring_index
(
'the king of the the hill'
,
'the'
,
1
);
select
substring_index
(
'the king of the the hill'
,
'the'
,
2
);
select
substring_index
(
'the king of the the hill'
,
'the'
,
3
);
select
concat
(
':'
,
ltrim
(
' left '
),
':'
,
rtrim
(
' right '
),
':'
);
select
concat
(
':'
,
trim
(
LEADING
FROM
' left'
),
':'
,
trim
(
TRAILING
FROM
' right '
),
':'
);
...
...
mysql-test/t/grant.test
View file @
7b1aed3f
...
...
@@ -402,4 +402,11 @@ flush privileges;
delete from tables_priv where host = '' and user = '
mysqltest_1
';
flush privileges;
#
# Bug #10892 user variables not auto cast for comparisons
# Check that we don'
t
get
illegal
mix
of
collations
#
set
@
user123
=
"non-existent"
;
select
*
from
mysql
.
db
where
user
=@
user123
;
# End of 4.1 tests
sql/item.cc
View file @
7b1aed3f
...
...
@@ -455,14 +455,18 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
;
// Do nothing
}
else
if
((
flags
&
MY_COLL_ALLOW_SUPERSET_CONV
)
&&
derivation
<
dt
.
derivation
&&
collation
->
state
&
MY_CS_UNICODE
)
collation
->
state
&
MY_CS_UNICODE
&&
(
derivation
<
dt
.
derivation
||
(
derivation
==
dt
.
derivation
&&
!
(
dt
.
collation
->
state
&
MY_CS_UNICODE
))))
{
// Do nothing
}
else
if
((
flags
&
MY_COLL_ALLOW_SUPERSET_CONV
)
&&
dt
.
derivation
<
derivation
&&
dt
.
collation
->
state
&
MY_CS_UNICODE
)
dt
.
collation
->
state
&
MY_CS_UNICODE
&&
(
dt
.
derivation
<
derivation
||
(
dt
.
derivation
==
derivation
&&
!
(
collation
->
state
&
MY_CS_UNICODE
))))
{
set
(
dt
);
}
...
...
sql/item_strfunc.cc
View file @
7b1aed3f
...
...
@@ -42,7 +42,7 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const
char
*
fname
)
{
my_error
(
ER_CANT_AGGREGATE_2COLLATIONS
,
MYF
(
0
),
c1
.
collation
->
name
,
c1
.
derivation_name
(),
c1
.
collation
->
name
,
c1
.
derivation_name
(),
c2
.
collation
->
name
,
c2
.
derivation_name
(),
fname
);
}
...
...
@@ -1188,10 +1188,22 @@ String *Item_func_substr_index::val_str(String *str)
}
else
{
// Start counting at end
for
(
offset
=
res
->
length
()
;
;
offset
-=
delimeter_length
-
1
)
/*
Negative index, start counting at the end
*/
for
(
offset
=
res
->
length
();
offset
;)
{
/*
this call will result in finding the position pointing to one
address space less than where the found substring is located
in res
*/
if
((
int
)
(
offset
=
res
->
strrstr
(
*
delimeter
,
offset
))
<
0
)
return
res
;
// Didn't find, return org string
/*
At this point, we've searched for the substring
the number of times as supplied by the index value
*/
if
(
!++
count
)
{
offset
+=
delimeter_length
;
...
...
strings/Makefile.am
View file @
7b1aed3f
...
...
@@ -23,7 +23,7 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if
ASSEMBLER_x86
ASRCS
=
strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
CSRCS
=
bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
CSRCS
=
bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
longlong2str_asm.c
else
if
ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
...
...
@@ -46,7 +46,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-win1
ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c
\
ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c
\
xml.c strto.c strings-x86.s
\
longlong2str.c longlong2str-x86.s
\
longlong2str.c longlong2str-x86.s
longlong2str_asm.c
\
my_strtoll10.c my_strtoll10-x86.s
\
strxmov.c bmove_upp.c strappend.c strcont.c strend.c
\
strfill.c strcend.c is_prefix.c strstr.c strinstr.c
\
...
...
strings/longlong2str-x86.s
View file @
7b1aed3f
...
...
@@ -16,26 +16,26 @@
#
Optimized
longlong2str
function
for
Intel
80
x86
(
gcc
/
gas
syntax
)
#
Some
set
sequences
are
optimized
for
pentuimpro
II
.
file
"longlong2str.s"
.
version
"1.0
1
"
.
file
"longlong2str
-x86
.s"
.
version
"1.0
2
"
.
text
.
align
4
.
globl
longlong2str
.
type
longlong2str
,
@
function
.
globl
longlong2str
_with_dig_vector
.
type
longlong2str
_with_dig_vector
,
@
function
longlong2str
:
longlong2str
_with_dig_vector
:
subl
$
80
,%
esp
pushl
%
ebp
pushl
%
esi
pushl
%
edi
pushl
%
ebx
movl
100
(%
esp
),%
esi
#
Lower
part
of
val
movl
104
(%
esp
),%
ebp
#
Higher
part
of
val
movl
108
(%
esp
),%
edi
#
get
dst
movl
112
(%
esp
),%
ebx
#
Radix
movl
104
(%
esp
),%
ebp
#
Higher
part
of
val
movl
%
ebx
,%
eax
movl
108
(%
esp
),%
edi
#
get
dst
testl
%
eax
,%
eax
jge
.
L144
...
...
@@ -69,6 +69,8 @@ longlong2str:
.
L150
:
leal
92
(%
esp
),%
ecx
#
End
of
buffer
movl
%
edi
,
108
(%
esp
)
#
Store
possible
modified
dest
movl
116
(%
esp
),
%
edi
#
dig_vec_upper
jmp
.
L155
.
align
4
...
...
@@ -83,7 +85,7 @@ longlong2str:
divl
%
ebx
decl
%
ecx
movl
%
eax
,%
esi
#
quotent
in
ebp
:
esi
movb
_dig_vec_upper
(%
edx
),%
al
#
al
is
faster
than
dl
movb
(%
edx
,%
edi
),%
al
#
al
is
faster
than
dl
movb
%
al
,(%
ecx
)
#
store
value
in
buff
.
align
4
.
L155
:
...
...
@@ -91,20 +93,22 @@ longlong2str:
ja
.
L153
testl
%
esi
,%
esi
#
rest
value
jl
.
L153
je
.
L1
0_mov
#
Ready
je
.
L1
60
#
Ready
movl
%
esi
,%
eax
movl
$
_dig_vec_upper
,%
ebp
.
align
4
.
L154
:
#
Do
rest
with
integer
precision
cltd
divl
%
ebx
decl
%
ecx
movb
(%
edx
,%
e
bp
),%
dl
#
bh
is
always
zero
as
ebx
=
radix
<
36
movb
(%
edx
,%
e
di
),%
dl
#
bh
is
always
zero
as
ebx
=
radix
<
36
testl
%
eax
,%
eax
movb
%
dl
,(%
ecx
)
jne
.
L154
.
L160
:
movl
108
(%
esp
),%
edi
#
get
dst
.
L10_mov
:
movl
%
ecx
,%
esi
leal
92
(%
esp
),%
ecx
#
End
of
buffer
...
...
@@ -129,7 +133,7 @@ longlong2str:
jmp
.
L165
.
Lfe3
:
.
size
longlong2str
,
.
Lfe3
-
longlong2st
r
.
size
longlong2str
_with_dig_vector
,
.
Lfe3
-
longlong2str_with_dig_vecto
r
#
#
This
is
almost
equal
to
the
above
,
except
that
we
can
do
the
final
...
...
@@ -137,9 +141,6 @@ longlong2str:
#
.
align
4
.
Ltmp
:
.
long
0xcccccccd
.
align
4
.
globl
longlong10_to_str
.
type
longlong10_to_str
,
@
function
...
...
@@ -202,8 +203,8 @@ longlong10_to_str:
#
The
following
code
uses
some
tricks
to
change
division
by
10
to
#
multiplication
and
shifts
movl
.
Ltmp
,%
esi
#
set
%
esi
to
0xcccccccd
movl
$
0xcccccccd
,%
esi
.
L10_40
:
movl
%
ebx
,%
eax
mull
%
esi
...
...
strings/longlong2str_asm.c
0 → 100644
View file @
7b1aed3f
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Wrapper for longlong2str.s
We need this because the assembler code can't access the local variable
_dig_vector in a portable manner.
*/
#include <my_global.h>
#include "m_string.h"
extern
char
*
longlong2str_with_dig_vector
(
longlong
val
,
char
*
dst
,
int
radix
,
const
char
*
dig_vector
);
char
*
longlong2str
(
longlong
val
,
char
*
dst
,
int
radix
)
{
return
longlong2str_with_dig_vector
(
val
,
dst
,
radix
,
_dig_vec_upper
);
}
strings/my_strtoll10-x86.s
View file @
7b1aed3f
...
...
@@ -17,21 +17,8 @@
#
For
documentation
,
check
my_strtoll
.
c
.
file
"my_strtoll10-x86.s"
.
version
"01.01"
.
data
.
align
32
.
type
lfactor
,
@
object
.
size
lfactor
,
36
lfactor
:
.
long
1
.
long
10
.
long
100
.
long
1000
.
long
10000
.
long
100000
.
long
1000000
.
long
10000000
.
long
100000000
.
version
"01.02"
.
text
.
align
4
...
...
@@ -209,14 +196,16 @@ my_strtoll10:
jne
.
L500
cmpl
-
36
(%
ebp
),%
esi
#
Test
if
string
is
less
than
18
digits
jne
.
Lend_i_and_j
jmp
.
Lend3
#
18
digit
string
.
L499
:
movl
$
1000000000
,%
eax
jmp
.
Lgot_factor
#
18
digit
string
#
Handle
the
possible
next
to
last
digit
and
store
in
ecx
.
L500
:
movb
(%
esi
),%
al
addb
$
-
48
,%
al
cmpb
$
9
,%
al
ja
.
L
end3
ja
.
L
499
#
18
digit
string
incl
%
esi
movzbl
%
al
,%
ecx
...
...
@@ -315,14 +304,41 @@ my_strtoll10:
.
Lend_i_and_j
:
movl
%
esi
,%
ecx
subl
-
12
(%
ebp
),%
ecx
#
ecx
=
number
of
digits
in
second
part
movl
lfactor
(,%
ecx
,
4
),%
eax
jmp
.
L523
#
Return
-
8
(%
ebp
)
*
$
1000000000
+
edi
#
Calculate
%
eax
=
10
**
%
cl
,
where
%
cl
<=
8
#
With
an
array
one
could
do
this
with
:
#
movl
10
_factor_table
(,%
ecx
,
4
),%
eax
#
We
calculate
the
table
here
to
avoid
problems
in
#
position
independent
code
(
gcc
-
pic
)
cmpb
$
3
,%
cl
ja
.
L4_to_8
movl
$
1000
,
%
eax
je
.
Lgot_factor
#
%
cl
=
3
,
eax
=
1000
movl
$
10
,
%
eax
cmpb
$
1
,%
cl
#
%
cl
is
here
0
-
2
je
.
Lgot_factor
#
%
cl
=
1
,
eax
=
10
movl
$
100
,
%
eax
ja
.
Lgot_factor
#
%
cl
=
2
,
eax
=
100
movl
$
1
,
%
eax
jmp
.
Lgot_factor
#
%
cl
=
0
,
eax
=
1
.
L4_to_8
:
#
%
cl
is
here
4
-
8
cmpb
$
5
,%
cl
movl
$
100000
,
%
eax
je
.
Lgot_factor
#
%
cl
=
5
,
eax
=
100000
movl
$
10000
,
%
eax
jbe
.
Lgot_factor
#
%
cl
=
4
,
eax
=
10000
movl
$
10000000
,
%
eax
cmpb
$
7
,%
cl
je
.
Lgot_factor
#
%
cl
=
7
,
eax
=
10000000
movl
$
100000000
,
%
eax
ja
.
Lgot_factor
#
%
cl
=
8
,
eax
=
100000000
movl
$
1000000
,
%
eax
#
%
cl
=
6
,
eax
=
1000000
#
Return
-
8
(%
ebp
)
*
%
eax
+
edi
.
p2align
4
,,
7
.
Lend3
:
movl
$
1000000000
,%
eax
.
L523
:
.
Lgot_factor
:
mull
-
8
(%
ebp
)
addl
%
edi
,%
eax
adcl
$
0
,%
edx
...
...
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