mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 22:23:04 +00:00
Merge pull request #22223 from Faless/fix_int32_encode
Fix put_var encoding some 32bits ints as 64bits.
This commit is contained in:
commit
ffa8420aec
@ -807,7 +807,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
|
||||
case Variant::INT: {
|
||||
int64_t val = p_variant;
|
||||
if (val > 0x7FFFFFFF || val < -0x80000000) {
|
||||
if (val > (int64_t)INT_MAX || val < (int64_t)INT_MIN) {
|
||||
flags |= ENCODE_FLAG_64;
|
||||
}
|
||||
} break;
|
||||
@ -851,7 +851,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
case Variant::INT: {
|
||||
|
||||
int64_t val = p_variant;
|
||||
if (val > 0x7FFFFFFF || val < -0x80000000) {
|
||||
if (flags & ENCODE_FLAG_64) {
|
||||
//64 bits
|
||||
if (buf) {
|
||||
encode_uint64(val, buf);
|
||||
@ -870,7 +870,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
|
||||
double d = p_variant;
|
||||
float f = d;
|
||||
if (double(f) != d) {
|
||||
if (flags & ENCODE_FLAG_64) {
|
||||
if (buf) {
|
||||
encode_double(p_variant.operator double(), buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user