mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
sproto bugfix
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "msvcint.h"
|
||||
|
||||
#include "lua.h"
|
||||
@@ -172,7 +173,7 @@ encode(const struct sproto_arg *args) {
|
||||
// It's decimal.
|
||||
lua_Number vn = lua_tonumber(L, -1);
|
||||
// use 64bit integer for 32bit architecture.
|
||||
v = (int64_t)(vn * args->extra + 0.5);
|
||||
v = (int64_t)(round(vn * args->extra));
|
||||
} else {
|
||||
v = lua_tointegerx(L, -1, &isnum);
|
||||
if(!isnum) {
|
||||
|
||||
Reference in New Issue
Block a user