提交 ab409503 编写于 作者: H Hongze Cheng

more

上级 d71830ac
...@@ -27,14 +27,7 @@ typedef struct { ...@@ -27,14 +27,7 @@ typedef struct {
uint8_t* data; uint8_t* data;
int64_t size; int64_t size;
int64_t pos; int64_t pos;
} SEncoder; } SEncoder, SDecoder;
typedef struct {
td_endian_t endian;
const uint8_t* data;
int64_t size;
int16_t pos;
} SDecoder;
#define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL) #define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL)
#define tGet(TYPE, BUF, VAL) (VAL) = ((TYPE*)(BUF))[0] #define tGet(TYPE, BUF, VAL) (VAL) = ((TYPE*)(BUF))[0]
...@@ -175,6 +168,7 @@ static FORCE_INLINE int tEncodeI64(SEncoder* pEncoder, int64_t val) { ...@@ -175,6 +168,7 @@ static FORCE_INLINE int tEncodeI64(SEncoder* pEncoder, int64_t val) {
return 0; return 0;
} }
// 16v
static FORCE_INLINE int tEncodeU16v(SEncoder* pEncoder, uint16_t val) { static FORCE_INLINE int tEncodeU16v(SEncoder* pEncoder, uint16_t val) {
int64_t i = 0; int64_t i = 0;
while (val >= ENCODE_LIMIT) { while (val >= ENCODE_LIMIT) {
...@@ -199,6 +193,7 @@ static FORCE_INLINE int tEncodeU16v(SEncoder* pEncoder, uint16_t val) { ...@@ -199,6 +193,7 @@ static FORCE_INLINE int tEncodeU16v(SEncoder* pEncoder, uint16_t val) {
static FORCE_INLINE int tEncodeI16v(SEncoder* pEncoder, int16_t val) { return tEncodeU16v(pEncoder, ZIGZAGE(val)); } static FORCE_INLINE int tEncodeI16v(SEncoder* pEncoder, int16_t val) { return tEncodeU16v(pEncoder, ZIGZAGE(val)); }
// 32v
static FORCE_INLINE int tEncodeU32v(SEncoder* pEncoder, uint32_t val) { static FORCE_INLINE int tEncodeU32v(SEncoder* pEncoder, uint32_t val) {
int64_t i = 0; int64_t i = 0;
while (val >= ENCODE_LIMIT) { while (val >= ENCODE_LIMIT) {
...@@ -223,6 +218,7 @@ static FORCE_INLINE int tEncodeU32v(SEncoder* pEncoder, uint32_t val) { ...@@ -223,6 +218,7 @@ static FORCE_INLINE int tEncodeU32v(SEncoder* pEncoder, uint32_t val) {
static FORCE_INLINE int tEncodeI32v(SEncoder* pEncoder, int32_t val) { return tEncodeU32v(pEncoder, ZIGZAGE(val)); } static FORCE_INLINE int tEncodeI32v(SEncoder* pEncoder, int32_t val) { return tEncodeU32v(pEncoder, ZIGZAGE(val)); }
// 64v
static FORCE_INLINE int tEncodeU64v(SEncoder* pEncoder, uint64_t val) { static FORCE_INLINE int tEncodeU64v(SEncoder* pEncoder, uint64_t val) {
int64_t i = 0; int64_t i = 0;
while (val >= ENCODE_LIMIT) { while (val >= ENCODE_LIMIT) {
...@@ -248,7 +244,7 @@ static FORCE_INLINE int tEncodeU64v(SEncoder* pEncoder, uint64_t val) { ...@@ -248,7 +244,7 @@ static FORCE_INLINE int tEncodeU64v(SEncoder* pEncoder, uint64_t val) {
static FORCE_INLINE int tEncodeI64v(SEncoder* pEncoder, int64_t val) { return tEncodeU64v(pEncoder, ZIGZAGE(val)); } static FORCE_INLINE int tEncodeI64v(SEncoder* pEncoder, int64_t val) { return tEncodeU64v(pEncoder, ZIGZAGE(val)); }
/* ------------------------ FOR DECODER ------------------------ */ /* ------------------------ FOR DECODER ------------------------ */
static FORCE_INLINE void tInitDecoder(SDecoder* pDecoder, td_endian_t endian, const uint8_t* data, int64_t size) { static FORCE_INLINE void tInitDecoder(SDecoder* pDecoder, td_endian_t endian, uint8_t* data, int64_t size) {
ASSERT(!TD_IS_NULL(data)); ASSERT(!TD_IS_NULL(data));
pDecoder->endian = endian; pDecoder->endian = endian;
pDecoder->data = data; pDecoder->data = data;
...@@ -346,6 +342,39 @@ static FORCER_INLINE int tDecodeI64(SDecoder* pDecoder, int64_t* val) { ...@@ -346,6 +342,39 @@ static FORCER_INLINE int tDecodeI64(SDecoder* pDecoder, int64_t* val) {
return 0; return 0;
} }
// 16v
static FORCE_INLINE int tDecodeU16v(SDecoder* pDecoder, uint16_t* val) {
// TODO
return 0;
}
static FORCE_INLINE int tDecodeI16v(SDecoder* pDecoder, int16_t* val) {
// TODO
return 0;
}
// 32v
static FORCE_INLINE int tDecodeU32v(SDecoder* pDecoder, uint32_t* val) {
// TODO
return 0;
}
static FORCE_INLINE int tDecodeI32v(SDecoder* pDecoder, int32_t* val) {
// TODO
return 0;
}
// 64v
static FORCE_INLINE int tDecodeU64v(SDecoder* pDecoder, uint64_t* val) {
// TODO
return 0;
}
static FORCE_INLINE int tDecodeI64v(SDecoder* pDecoder, int64_t* val) {
// TODO
return 0;
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册