mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
negative decimal number
This commit is contained in:
@@ -252,7 +252,7 @@ If n is odd, that means the tags is not continuous, and we should add current ta
|
|||||||
|
|
||||||
Arrays are always encode in data part, 4 bytes header for the size, and the following bytes is the contents. See the example 2 for the struct array; example 3/4 for the integer array ; example 5 for the boolean array.
|
Arrays are always encode in data part, 4 bytes header for the size, and the following bytes is the contents. See the example 2 for the struct array; example 3/4 for the integer array ; example 5 for the boolean array.
|
||||||
|
|
||||||
Fot integer array, an additional byte (4 or 8) to indicate the value is 32bit or 64bit.
|
For integer array, an additional byte (4 or 8) to indicate the value is 32bit or 64bit.
|
||||||
|
|
||||||
Read the examples below to see more details.
|
Read the examples below to see more details.
|
||||||
|
|
||||||
|
|||||||
@@ -344,12 +344,12 @@ decode(const struct sproto_arg *args) {
|
|||||||
// notice: in lua 5.2, 52bit integer support (not 64)
|
// notice: in lua 5.2, 52bit integer support (not 64)
|
||||||
if (args->extra) {
|
if (args->extra) {
|
||||||
// lua_Integer is 32bit in small lua.
|
// lua_Integer is 32bit in small lua.
|
||||||
uint64_t v = *(uint64_t*)args->value;
|
int64_t v = *(int64_t*)args->value;
|
||||||
lua_Number vn = (lua_Number)v;
|
lua_Number vn = (lua_Number)v;
|
||||||
vn /= args->extra;
|
vn /= args->extra;
|
||||||
lua_pushnumber(L, vn);
|
lua_pushnumber(L, vn);
|
||||||
} else {
|
} else {
|
||||||
lua_Integer v = *(uint64_t*)args->value;
|
lua_Integer v = *(int64_t*)args->value;
|
||||||
lua_pushinteger(L, v);
|
lua_pushinteger(L, v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user