summaryrefslogtreecommitdiff
path: root/external/mit
diff options
context:
space:
mode:
authornikita <nikita@NetBSD.org>2023-04-21 17:31:33 +0000
committernikita <nikita@NetBSD.org>2023-04-21 17:31:33 +0000
commitef41b58a32bf6fa21cec8919bd1cbbc8546608c6 (patch)
tree8fc23f5742e90c4a83a2d2e40e7832c4546400b5 /external/mit
parent5405a5f3924ccd7f7cb92c33cb7d1134f3c68f6c (diff)
lua: fix ftb in lvm.c
Diffstat (limited to 'external/mit')
-rw-r--r--external/mit/lua/dist/src/lvm.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/external/mit/lua/dist/src/lvm.c b/external/mit/lua/dist/src/lvm.c
index 569add69458..680a1ec4c2a 100644
--- a/external/mit/lua/dist/src/lvm.c
+++ b/external/mit/lua/dist/src/lvm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lvm.c,v 1.17 2023/04/17 20:37:43 nikita Exp $ */
+/* $NetBSD: lvm.c,v 1.18 2023/04/21 17:31:33 nikita Exp $ */
/*
** Id: lvm.c
@@ -500,18 +500,16 @@ l_sinline int LEfloatint (lua_Number f, lua_Integer i) {
/*
** Return 'l < r', for numbers.
*/
+#ifndef _KERNEL
l_sinline int LTnum (const TValue *l, const TValue *r) {
lua_assert(ttisnumber(l) && ttisnumber(r));
if (ttisinteger(l)) {
lua_Integer li = ivalue(l);
if (ttisinteger(r))
return li < ivalue(r); /* both are integers */
-#ifndef _KERNEL
else /* 'l' is int and 'r' is float */
return LTintfloat(li, fltvalue(r)); /* l < r ? */
-#endif /* _KERNEL */
}
-#ifndef _KERNEL
else {
lua_Number lf = fltvalue(l); /* 'l' must be float */
if (ttisfloat(r))
@@ -519,25 +517,30 @@ l_sinline int LTnum (const TValue *l, const TValue *r) {
else /* 'l' is float and 'r' is int */
return LTfloatint(lf, ivalue(r));
}
+}
#endif /* _KERNEL */
+#ifdef _KERNEL
+l_sinline int LTnum (const TValue *l, const TValue *r) {
+ lua_assert(ttisnumber(l));
+ lua_assert(ttisnumber(r));
+ return ivalue(l) < ivalue(r); /* both are integers */
}
+#endif /* _KERNEL */
/*
** Return 'l <= r', for numbers.
*/
+#ifndef _KERNEL
l_sinline int LEnum (const TValue *l, const TValue *r) {
lua_assert(ttisnumber(l) && ttisnumber(r));
if (ttisinteger(l)) {
lua_Integer li = ivalue(l);
if (ttisinteger(r))
return li <= ivalue(r); /* both are integers */
-#ifndef _KERNEL
else /* 'l' is int and 'r' is float */
return LEintfloat(li, fltvalue(r)); /* l <= r ? */
-#endif /* _KERNEL */
}
-#ifndef _KERNEL
else {
lua_Number lf = fltvalue(l); /* 'l' must be float */
if (ttisfloat(r))
@@ -545,8 +548,15 @@ l_sinline int LEnum (const TValue *l, const TValue *r) {
else /* 'l' is float and 'r' is int */
return LEfloatint(lf, ivalue(r));
}
+}
#endif /* _KERNEL */
+#ifdef _KERNEL
+l_sinline int LEnum (const TValue *l, const TValue *r) {
+ lua_assert(ttisinteger(l));
+ lua_assert(ttisinteger(r));
+ return ivalue(l) <= ivalue(r); /* both are integers */
}
+#endif /* _KERNEL */
/*