Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
3031aeb9
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3031aeb9
编写于
7月 12, 2021
作者:
T
tickduan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
prove coversion speed
上级
60e056a2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
42 deletion
+28
-42
deps/SZ/sz/src/ByteToolkit.c
deps/SZ/sz/src/ByteToolkit.c
+28
-42
未找到文件。
deps/SZ/sz/src/ByteToolkit.c
浏览文件 @
3031aeb9
...
...
@@ -14,25 +14,12 @@
INLINE
int
bytesToInt_bigEndian
(
unsigned
char
*
bytes
)
{
int
temp
=
0
;
int
res
=
0
;
res
<<=
8
;
temp
=
bytes
[
0
]
&
0xff
;
res
|=
temp
;
res
<<=
8
;
temp
=
bytes
[
1
]
&
0xff
;
res
|=
temp
;
res
<<=
8
;
temp
=
bytes
[
2
]
&
0xff
;
res
|=
temp
;
res
<<=
8
;
temp
=
bytes
[
3
]
&
0xff
;
res
|=
temp
;
int
res
;
unsigned
char
*
des
=
(
unsigned
char
*
)
&
res
;
des
[
0
]
=
bytes
[
3
];
des
[
1
]
=
bytes
[
2
];
des
[
2
]
=
bytes
[
1
];
des
[
3
]
=
bytes
[
0
];
return
res
;
}
...
...
@@ -42,20 +29,18 @@ INLINE int bytesToInt_bigEndian(unsigned char* bytes)
* */
INLINE
void
intToBytes_bigEndian
(
unsigned
char
*
b
,
unsigned
int
num
)
{
b
[
0
]
=
(
unsigned
char
)(
num
>>
24
);
b
[
1
]
=
(
unsigned
char
)(
num
>>
16
);
b
[
2
]
=
(
unsigned
char
)(
num
>>
8
);
b
[
3
]
=
(
unsigned
char
)(
num
);
//note: num >> xxx already considered endian_type...
//if(dataEndianType==LITTLE_ENDIAN_DATA)
// symTransform_4bytes(*b); //change to BIG_ENDIAN_DATA
unsigned
char
*
sou
=
(
unsigned
char
*
)
&
num
;
b
[
0
]
=
sou
[
3
];
b
[
1
]
=
sou
[
2
];
b
[
2
]
=
sou
[
1
];
b
[
3
]
=
sou
[
0
];
}
/**
* @endianType: refers to the endian_type of unsigned char* b.
* */
INLINE
long
bytesToLong_bigEndian
(
unsigned
char
*
b
)
{
long
temp
=
0
;
long
res
=
0
;
...
...
@@ -92,25 +77,29 @@ INLINE long bytesToLong_bigEndian(unsigned char* b) {
res
|=
temp
;
return
res
;
}
INLINE
void
longToBytes_bigEndian
(
unsigned
char
*
b
,
unsigned
long
num
)
INLINE
void
longToBytes_bigEndian
(
unsigned
char
*
b
,
long
num
)
{
// arm32
unsigned
char
*
sou
=
(
unsigned
char
*
)
&
num
;
#if defined(_TD_LINUX_64) || defined(_TD_ARM_64) || defined(_TD_DARWIN_64)
b
[
0
]
=
(
unsigned
char
)(
num
>>
56
);
b
[
1
]
=
(
unsigned
char
)(
num
>>
48
);
b
[
2
]
=
(
unsigned
char
)(
num
>>
40
);
b
[
3
]
=
(
unsigned
char
)(
num
>>
32
);
// 8 bytes
b
[
7
]
=
sou
[
0
];
b
[
6
]
=
sou
[
1
];
b
[
5
]
=
sou
[
2
];
b
[
4
]
=
sou
[
3
];
b
[
3
]
=
sou
[
4
];
b
[
2
]
=
sou
[
5
];
b
[
1
]
=
sou
[
6
];
b
[
0
]
=
sou
[
7
];
#else
memset
(
b
,
0
,
4
);
b
[
7
]
=
sou
[
0
];
b
[
6
]
=
sou
[
1
];
b
[
5
]
=
sou
[
2
];
b
[
4
]
=
sou
[
3
];
#endif
b
[
4
]
=
(
unsigned
char
)(
num
>>
24
);
b
[
5
]
=
(
unsigned
char
)(
num
>>
16
);
b
[
6
]
=
(
unsigned
char
)(
num
>>
8
);
b
[
7
]
=
(
unsigned
char
)(
num
);
// if(dataEndianType==LITTLE_ENDIAN_DATA)
// symTransform_8bytes(*b);
}
//TODO: debug: lfBuf.lvalue could be actually little_endian....
...
...
@@ -135,9 +124,6 @@ INLINE short getPrecisionReqLength_float(float precision)
int
expValue
=
(
ivalue
&
0x7F800000
)
>>
23
;
expValue
-=
127
;
// unsigned char the1stManBit = (unsigned char)((ivalue & 0x00400000) >> 22);
// if(the1stManBit==1)
// expValue--;
return
(
short
)
expValue
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录