Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c90123c0
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c90123c0
编写于
9月 19, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
747ce081
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
12 deletion
+16
-12
source/util/src/tcompression.c
source/util/src/tcompression.c
+16
-12
未找到文件。
source/util/src/tcompression.c
浏览文件 @
c90123c0
...
...
@@ -1193,9 +1193,9 @@ static int32_t tCompTimestamp(SCompressor *pCmprsor, int64_t ts) {
// Integer =====================================================
#define SIMPLE8B_MAX ((uint64_t)1152921504606846974LL)
static
const
char
BIT_PER_INTEGER
[]
=
{
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
10
,
12
,
15
,
20
,
30
,
60
};
static
const
uint8_t
BIT_PER_INTEGER
[]
=
{
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
10
,
12
,
15
,
20
,
30
,
60
};
static
const
int32_t
SELECTOR_TO_ELEMS
[]
=
{
240
,
120
,
60
,
30
,
20
,
15
,
12
,
10
,
8
,
7
,
6
,
5
,
4
,
3
,
2
,
1
};
static
const
char
BIT_TO_SELECTOR
[]
=
{
0
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
10
,
11
,
11
,
12
,
12
,
12
,
static
const
uint8_t
BIT_TO_SELECTOR
[]
=
{
0
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
10
,
11
,
11
,
12
,
12
,
12
,
13
,
13
,
13
,
13
,
13
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
};
...
...
@@ -1254,7 +1254,7 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
pCmprsor
->
i_prev
=
val
;
while
(
1
)
{
int32_t
nEle
=
pCmprsor
->
i_end
-
pCmprsor
->
i_start
;
int32_t
nEle
=
(
pCmprsor
->
i_end
+
241
-
pCmprsor
->
i_start
)
%
241
;
if
(
nEle
+
1
<=
SELECTOR_TO_ELEMS
[
pCmprsor
->
i_selector
]
&&
nEle
+
1
<=
SELECTOR_TO_ELEMS
[
BIT_TO_SELECTOR
[
nBit
]])
{
if
(
pCmprsor
->
i_selector
<
BIT_TO_SELECTOR
[
nBit
])
{
...
...
@@ -1270,19 +1270,23 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
}
nEle
=
SELECTOR_TO_ELEMS
[
pCmprsor
->
i_selector
];
code
=
tRealloc
(
&
pCmprsor
->
aBuf
[
0
],
pCmprsor
->
nBuf
[
0
]
+
sizeof
(
uint64_t
));
if
(
code
)
return
code
;
if
(
pCmprsor
->
autoAlloc
)
{
code
=
tRealloc
(
&
pCmprsor
->
aBuf
[
0
],
pCmprsor
->
nBuf
[
0
]
+
sizeof
(
uint64_t
));
if
(
code
)
return
code
;
}
// uint64_t *bp = (uint64_t *)(pCmprsor->aBuf[0] + pCmprsor->nBuf[0]);
// pCmprsor->nBuf[0] += sizeof(uint64_t);
// bp[0] = pCmprsor->i_selector;
// for (int32_t iVal = 0; iVal < pCmprsor->i_nele; iVal++) {
// /* code */
// }
uint64_t
*
bp
=
(
uint64_t
*
)(
pCmprsor
->
aBuf
[
0
]
+
pCmprsor
->
nBuf
[
0
]);
pCmprsor
->
nBuf
[
0
]
+=
sizeof
(
uint64_t
);
bp
[
0
]
=
pCmprsor
->
i_selector
;
uint8_t
bits
=
BIT_PER_INTEGER
[
pCmprsor
->
i_selector
];
for
(
int32_t
iVal
=
0
;
iVal
<
nEle
;
iVal
++
)
{
bp
[
0
]
|=
((
pCmprsor
->
i_aZigzag
[
pCmprsor
->
i_start
]
&
((((
uint64_t
)
1
)
<<
bits
)
-
1
))
<<
(
bits
*
iVal
+
4
));
pCmprsor
->
i_start
=
(
pCmprsor
->
i_start
+
1
)
%
241
;
}
// reset and continue
pCmprsor
->
i_selector
=
0
;
for
(
int32_t
iVal
=
pCmprsor
->
i_start
;
iVal
<
pCmprsor
->
i_end
;
iVal
++
)
{
for
(
int32_t
iVal
=
pCmprsor
->
i_start
;
iVal
<
pCmprsor
->
i_end
;
iVal
=
(
iVal
+
1
)
%
241
)
{
if
(
pCmprsor
->
i_selector
<
BIT_TO_SELECTOR
[
pCmprsor
->
i_aBitN
[
iVal
]])
{
pCmprsor
->
i_selector
=
BIT_TO_SELECTOR
[
pCmprsor
->
i_aBitN
[
iVal
]];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录