Skip to content

Commit

Permalink
LuaFAR: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Feb 6, 2024
1 parent 8c3259f commit f73126c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 3, 0, 0, 804 },
Version = { 3, 0, 0, 805 },
MinFarVersion = { 3, 0, 0, 6214 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
4 changes: 4 additions & 0 deletions plugins/luamacro/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
shmuel 2024-02-06 09:34:58+02:00 - build 805

1. LuaFAR: refactoring.

rohitab 2024-02-03 13:39:53+11:00 - build 804

1. LuaFAR: add MOUSE_HWHEELED flag.
Expand Down
8 changes: 5 additions & 3 deletions plugins/luamacro/luafar/bit64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <lauxlib.h>
#include <lualib.h>

#define MAX53 0x1FFFFFFFFFFFFFLL
#define MAX52 (1LL << 52)
#define FIT52(v) ((v >= 0 && v < MAX52) || (v < 0 && v >= -MAX52))

typedef __int64 INT64;
typedef unsigned __int64 UINT64;
static int f_new(lua_State *L); /* forward declaration */
Expand All @@ -19,7 +21,7 @@ int bit64_pushuserdata(lua_State *L, INT64 v)

int bit64_push(lua_State *L, INT64 v)
{
if((v >= 0 && v <= MAX53) || (v < 0 && v >= -MAX53))
if (FIT52(v))
lua_pushnumber(L, (double)v);
else
bit64_pushuserdata(L, v);
Expand Down Expand Up @@ -59,7 +61,7 @@ INT64 check64(lua_State *L, int pos, int* success)
if(tp == LUA_TNUMBER)
{
double dd = lua_tonumber(L, pos);
if ((dd>=0 && dd<=0x7fffffffffffffffULL) || (dd<0 && -dd<=0x8000000000000000ULL))
if (FIT52(dd))
return (INT64)dd;
}
else
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luafar/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 804
#define PLUGIN_BUILD 805

0 comments on commit f73126c

Please sign in to comment.