mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
update sproto for big-endian
This commit is contained in:
@@ -252,12 +252,12 @@ decode(void *ud, const char *tagname, int type, int index, struct sproto_type *s
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case SPROTO_TINTEGER: {
|
case SPROTO_TINTEGER: {
|
||||||
// notice: in lua 5.2, 52bit integer support (not 64)
|
// notice: in lua 5.2, 52bit integer support (not 64)
|
||||||
lua_Integer v = *(lua_Integer *)value;
|
lua_Integer v = *(uint64_t*)value;
|
||||||
lua_pushinteger(L, v);
|
lua_pushinteger(L, v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPROTO_TBOOLEAN: {
|
case SPROTO_TBOOLEAN: {
|
||||||
int v = *(lua_Integer*)value;
|
int v = *(uint64_t*)value;
|
||||||
lua_pushboolean(L,v);
|
lua_pushboolean(L,v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -971,7 +971,7 @@ decode_array(sproto_callback cb, void *ud, struct field *f, uint8_t * stream) {
|
|||||||
}
|
}
|
||||||
case SPROTO_TBOOLEAN:
|
case SPROTO_TBOOLEAN:
|
||||||
for (i=0;i<sz;i++) {
|
for (i=0;i<sz;i++) {
|
||||||
int value = stream[i];
|
uint64_t value = stream[i];
|
||||||
cb(ud, f->name, SPROTO_TBOOLEAN, i+1, NULL, &value, sizeof(value));
|
cb(ud, f->name, SPROTO_TBOOLEAN, i+1, NULL, &value, sizeof(value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user