mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 20:50:52 +02:00
update luajit to LuaJIT/LuaJIT@8e6520a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** C type conversions.
|
||||
** Copyright (C) 2005-2025 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2026 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
@@ -197,18 +197,16 @@ void lj_cconv_ct_ct(CTState *cts, CType *d, CType *s,
|
||||
else goto err_conv; /* NYI: long double. */
|
||||
/* Then convert double to integer. */
|
||||
/* The conversion must exactly match the semantics of JIT-compiled code! */
|
||||
if (dsize < 4 || (dsize == 4 && !(dinfo & CTF_UNSIGNED))) {
|
||||
int32_t i = (int32_t)n;
|
||||
if (dsize < 8) {
|
||||
int64_t i = lj_num2i64(n); /* Always convert via int64_t. */
|
||||
if (dsize == 4) *(int32_t *)dp = i;
|
||||
else if (dsize == 2) *(int16_t *)dp = (int16_t)i;
|
||||
else *(int8_t *)dp = (int8_t)i;
|
||||
} else if (dsize == 4) {
|
||||
*(uint32_t *)dp = (uint32_t)n;
|
||||
} else if (dsize == 8) {
|
||||
if (!(dinfo & CTF_UNSIGNED))
|
||||
*(int64_t *)dp = (int64_t)n;
|
||||
else
|
||||
if ((dinfo & CTF_UNSIGNED))
|
||||
*(uint64_t *)dp = lj_num2u64(n);
|
||||
else
|
||||
*(int64_t *)dp = lj_num2i64(n);
|
||||
} else {
|
||||
goto err_conv; /* NYI: conversion to >64 bit integers. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user