Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27360702
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
27360702
编写于
12月 28, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
finish encoding
上级
8ec2dd7d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
6 deletion
+63
-6
include/util/encode.h
include/util/encode.h
+63
-6
未找到文件。
include/util/encode.h
浏览文件 @
27360702
...
...
@@ -350,34 +350,91 @@ static FORCER_INLINE int tDecodeI64(SDecoder* pDecoder, int64_t* val) {
// 16v
static
FORCE_INLINE
int
tDecodeU16v
(
SDecoder
*
pDecoder
,
uint16_t
*
val
)
{
// TODO
int64_t
i
=
0
;
*
val
=
0
;
for
(;;)
{
if
(
TD_CHECK_CODER_CAPACITY_FAILED
(
pDecoder
,
1
))
return
-
1
;
uint16_t
tval
=
TD_CODER_CURRENT
(
pDecoder
)[
i
];
if
(
tval
<
ENCODE_LIMIT
)
{
(
*
val
)
|=
(
tval
<<
(
7
*
i
));
break
;
}
else
{
(
*
val
)
|=
(((
tval
)
&
(
ENCODE_LIMIT
-
1
))
<<
(
7
*
i
));
i
++
;
}
}
TD_CODER_MOVE_POS
(
pDecoder
,
i
);
return
0
;
}
static
FORCE_INLINE
int
tDecodeI16v
(
SDecoder
*
pDecoder
,
int16_t
*
val
)
{
// TODO
uint16_t
tval
;
if
(
tDecodeU16v
(
pDecoder
,
&
tval
)
<
0
)
{
return
-
1
;
}
*
val
=
ZIGZAGD
(
int16_t
,
tval
);
return
0
;
}
// 32v
static
FORCE_INLINE
int
tDecodeU32v
(
SDecoder
*
pDecoder
,
uint32_t
*
val
)
{
// TODO
int64_t
i
=
0
;
*
val
=
0
;
for
(;;)
{
if
(
TD_CHECK_CODER_CAPACITY_FAILED
(
pDecoder
,
1
))
return
-
1
;
uint32_t
tval
=
TD_CODER_CURRENT
(
pDecoder
)[
i
];
if
(
tval
<
ENCODE_LIMIT
)
{
(
*
val
)
|=
(
tval
<<
(
7
*
i
));
break
;
}
else
{
(
*
val
)
|=
(((
tval
)
&
(
ENCODE_LIMIT
-
1
))
<<
(
7
*
i
));
i
++
;
}
}
TD_CODER_MOVE_POS
(
pDecoder
,
i
);
return
0
;
}
static
FORCE_INLINE
int
tDecodeI32v
(
SDecoder
*
pDecoder
,
int32_t
*
val
)
{
// TODO
uint32_t
tval
;
if
(
tDecodeU32v
(
pDecoder
,
&
tval
)
<
0
)
{
return
-
1
;
}
*
val
=
ZIGZAGD
(
int32_t
,
tval
);
return
0
;
}
// 64v
static
FORCE_INLINE
int
tDecodeU64v
(
SDecoder
*
pDecoder
,
uint64_t
*
val
)
{
// TODO
int64_t
i
=
0
;
*
val
=
0
;
for
(;;)
{
if
(
TD_CHECK_CODER_CAPACITY_FAILED
(
pDecoder
,
1
))
return
-
1
;
uint64_t
tval
=
TD_CODER_CURRENT
(
pDecoder
)[
i
];
if
(
tval
<
ENCODE_LIMIT
)
{
(
*
val
)
|=
(
tval
<<
(
7
*
i
));
break
;
}
else
{
(
*
val
)
|=
(((
tval
)
&
(
ENCODE_LIMIT
-
1
))
<<
(
7
*
i
));
i
++
;
}
}
TD_CODER_MOVE_POS
(
pDecoder
,
i
);
return
0
;
}
static
FORCE_INLINE
int
tDecodeI64v
(
SDecoder
*
pDecoder
,
int64_t
*
val
)
{
// TODO
uint64_t
tval
;
if
(
tDecodeU64v
(
pDecoder
,
&
tval
)
<
0
)
{
return
-
1
;
}
*
val
=
ZIGZAGD
(
int64_t
,
tval
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录