Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8e892abd
提交
8e892abd
authored
1月 08, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix 64 bit upper/lower
上级
11a7f424
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
31 行增加
和
6 行删除
+31
-6
switch_utils.h
src/include/switch_utils.h
+31
-6
没有找到文件。
src/include/switch_utils.h
浏览文件 @
8e892abd
...
@@ -47,10 +47,10 @@ SWITCH_BEGIN_EXTERN_C
...
@@ -47,10 +47,10 @@ SWITCH_BEGIN_EXTERN_C
*/
*/
static
inline
uint32_t
switch_toupper
(
uint32_t
eax
)
static
inline
uint32_t
switch_toupper
(
uint32_t
eax
)
{
{
uint32_t
ebx
=
(
0x7f7f7f7ful
&
eax
)
+
0x05050505ul
;
uint32_t
ebx
=
(
0x7f7f7f7ful
&
eax
)
+
0x05050505ul
;
ebx
=
(
0x7f7f7f7ful
&
ebx
)
+
0x1a1a1a1aul
;
ebx
=
(
0x7f7f7f7ful
&
ebx
)
+
0x1a1a1a1aul
;
ebx
=
((
ebx
&
~
eax
)
>>
2
)
&
0x20202020ul
;
ebx
=
((
ebx
&
~
eax
)
>>
2
)
&
0x20202020ul
;
return
eax
-
ebx
;
return
eax
-
ebx
;
}
}
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
...
@@ -64,8 +64,31 @@ static inline uint32_t switch_tolower(uint32_t eax)
...
@@ -64,8 +64,31 @@ static inline uint32_t switch_tolower(uint32_t eax)
return
eax
+
ebx
;
return
eax
+
ebx
;
}
}
#ifdef FS_64BIT
#ifdef FS_64BIT
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
http://www.azillionmonkeys.com/qed/asmexample.html
*/
static
inline
uint64_t
switch_toupper64
(
uint64_t
eax
)
{
uint64_t
ebx
=
(
0x7f7f7f7f7f7f7f7full
&
eax
)
+
0x0505050505050505ull
;
ebx
=
(
0x7f7f7f7f7f7f7f7full
&
ebx
)
+
0x1a1a1a1a1a1a1a1aull
;
ebx
=
((
ebx
&
~
eax
)
>>
2
)
&
0x2020202020202020ull
;
return
eax
-
ebx
;
}
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
http://www.azillionmonkeys.com/qed/asmexample.html
*/
static
inline
uint64_t
switch_tolower64
(
uint64_t
eax
)
{
uint64_t
ebx
=
(
0x7f7f7f7f7f7f7f7full
&
eax
)
+
0x2525252525252525ull
;
ebx
=
(
0x7f7f7f7f7f7f7f7full
&
ebx
)
+
0x1a1a1a1a1a1a1a1aull
;
ebx
=
((
ebx
&
~
eax
)
>>
2
)
&
0x2020202020202020ull
;
return
eax
+
ebx
;
}
static
inline
void
switch_toupper_max
(
char
*
s
)
static
inline
void
switch_toupper_max
(
char
*
s
)
{
{
uint64_t
*
b
,
*
p
;
uint64_t
*
b
,
*
p
;
...
@@ -78,7 +101,7 @@ static inline void switch_toupper_max(char *s)
...
@@ -78,7 +101,7 @@ static inline void switch_toupper_max(char *s)
while
(
l
>
8
)
{
while
(
l
>
8
)
{
b
=
p
;
b
=
p
;
*
b
=
(
uint
32_t
)
switch_toupper
(
*
b
);
*
b
=
(
uint
64_t
)
switch_toupper64
(
*
b
);
b
++
;
b
++
;
p
++
;
p
++
;
l
-=
8
;
l
-=
8
;
...
@@ -106,7 +129,7 @@ static inline void switch_tolower_max(char *s)
...
@@ -106,7 +129,7 @@ static inline void switch_tolower_max(char *s)
while
(
l
>
8
)
{
while
(
l
>
8
)
{
b
=
p
;
b
=
p
;
*
b
=
(
uint
32_t
)
switch_tolower
(
*
b
);
*
b
=
(
uint
64_t
)
switch_tolower64
(
*
b
);
b
++
;
b
++
;
p
++
;
p
++
;
l
-=
8
;
l
-=
8
;
...
@@ -182,6 +205,8 @@ static inline void switch_tolower_max(char *s)
...
@@ -182,6 +205,8 @@ static inline void switch_tolower_max(char *s)
#endif
#endif
SWITCH_DECLARE
(
int
)
old_switch_toupper
(
int
c
);
SWITCH_DECLARE
(
int
)
old_switch_toupper
(
int
c
);
SWITCH_DECLARE
(
int
)
old_switch_tolower
(
int
c
);
SWITCH_DECLARE
(
int
)
old_switch_tolower
(
int
c
);
SWITCH_DECLARE
(
int
)
switch_isalnum
(
int
c
);
SWITCH_DECLARE
(
int
)
switch_isalnum
(
int
c
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论