diff options
author | Mike Pall <mike> | 2010-12-31 00:46:29 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-12-31 00:46:29 +0100 |
commit | dc4b82c33d04930bbc2e54673ebea41ffa3368fc (patch) | |
tree | 4feab1b979ef6ecd1bccb5af613410ccd823a9fd /src/lj_obj.h | |
parent | 4668b229de64a839857391808c90f92290125ad8 (diff) | |
download | luajit-dc4b82c33d04930bbc2e54673ebea41ffa3368fc.tar.gz luajit-dc4b82c33d04930bbc2e54673ebea41ffa3368fc.tar.bz2 luajit-dc4b82c33d04930bbc2e54673ebea41ffa3368fc.zip |
Add lj_num2u64 for number to uint64_t conversion.
Diffstat (limited to 'src/lj_obj.h')
-rw-r--r-- | src/lj_obj.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h index d735b0e8..456aef0b 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h | |||
@@ -763,6 +763,17 @@ static LJ_AINLINE int32_t lj_num2bit(lua_Number n) | |||
763 | #define lj_num2int(n) ((int32_t)(n)) | 763 | #define lj_num2int(n) ((int32_t)(n)) |
764 | #endif | 764 | #endif |
765 | 765 | ||
766 | static LJ_AINLINE uint64_t lj_num2u64(lua_Number n) | ||
767 | { | ||
768 | #ifdef _MSC_VER | ||
769 | if (n >= 9223372036854775808.0) /* They think it's a feature. */ | ||
770 | return (uint64_t)(int64_t)(n - 9223372036854775808.0) + | ||
771 | U64x(80000000,00000000); | ||
772 | else | ||
773 | #endif | ||
774 | return (uint64_t)n; | ||
775 | } | ||
776 | |||
766 | /* -- Miscellaneous object handling --------------------------------------- */ | 777 | /* -- Miscellaneous object handling --------------------------------------- */ |
767 | 778 | ||
768 | /* Names and maps for internal and external object tags. */ | 779 | /* Names and maps for internal and external object tags. */ |