summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/rbwrappers.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-04-29 18:21:56 -0400
committerFranklin Wei <git@fwei.tk>2017-04-29 18:24:42 -0400
commit881746789a489fad85aae8317555f73dbe261556 (patch)
treecec2946362c4698c8db3c10f3242ef546c2c22dd /apps/plugins/puzzles/rbwrappers.c
parent03dd4b92be7dcd5c8ab06da3810887060e06abd5 (diff)
downloadrockbox-881746789a489fad85aae8317555f73dbe261556.tar.gz
rockbox-881746789a489fad85aae8317555f73dbe261556.zip
puzzles: refactor and resync with upstream
This brings puzzles up-to-date with upstream revision 2d333750272c3967cfd5cd3677572cddeaad5932, though certain changes made by me, including cursor-only Untangle and some compilation fixes remain. Upstream code has been moved to its separate subdirectory and future syncs can be done by simply copying over the new sources. Change-Id: Ia6506ca5f78c3627165ea6791d38db414ace0804
Diffstat (limited to 'apps/plugins/puzzles/rbwrappers.c')
-rw-r--r--apps/plugins/puzzles/rbwrappers.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/apps/plugins/puzzles/rbwrappers.c b/apps/plugins/puzzles/rbwrappers.c
index e595cf93d1..4fbfdc4e60 100644
--- a/apps/plugins/puzzles/rbwrappers.c
+++ b/apps/plugins/puzzles/rbwrappers.c
@@ -1346,9 +1346,12 @@ double scalbn_wrapper (double x, int n)
1346 if (k > 0) /* normal result */ 1346 if (k > 0) /* normal result */
1347 {__HI(x) = (hx&0x800fffff)|(k<<20); return x;} 1347 {__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
1348 if (k <= -54) 1348 if (k <= -54)
1349 {
1349 if (n > 50000) /* in case integer overflow in n+k */ 1350 if (n > 50000) /* in case integer overflow in n+k */
1350 return huge*copysign_wrapper(huge,x); /*overflow*/ 1351 return huge*copysign_wrapper(huge,x); /*overflow*/
1351 else return tiny*copysign_wrapper(tiny,x); /*underflow*/ 1352 else
1353 return tiny*copysign_wrapper(tiny,x); /*underflow*/
1354 }
1352 k += 54; /* subnormal result */ 1355 k += 54; /* subnormal result */
1353 __HI(x) = (hx&0x800fffff)|(k<<20); 1356 __HI(x) = (hx&0x800fffff)|(k<<20);
1354 return x*twom54; 1357 return x*twom54;
@@ -1608,18 +1611,6 @@ static void bcopy_wrapper(const void *src, void *dst, size_t n)
1608} 1611}
1609 1612
1610int 1613int
1611sscanf_wrapper(const char *ibuf, const char *fmt, ...)
1612{
1613 va_list ap;
1614 int ret;
1615
1616 va_start(ap, fmt);
1617 ret = rb_vsscanf(ibuf, fmt, ap);
1618 va_end(ap);
1619 return(ret);
1620}
1621
1622int
1623rb_vsscanf(const char *inp, char const *fmt0, va_list ap) 1614rb_vsscanf(const char *inp, char const *fmt0, va_list ap)
1624{ 1615{
1625 int inr; 1616 int inr;
@@ -2065,6 +2056,18 @@ match_failure:
2065 return (nassigned); 2056 return (nassigned);
2066} 2057}
2067 2058
2059int
2060sscanf_wrapper(const char *ibuf, const char *fmt, ...)
2061{
2062 va_list ap;
2063 int ret;
2064
2065 va_start(ap, fmt);
2066 ret = rb_vsscanf(ibuf, fmt, ap);
2067 va_end(ap);
2068 return(ret);
2069}
2070
2068/* 2071/*
2069 * Fill in the given table from the scanset at the given format 2072 * Fill in the given table from the scanset at the given format
2070 * (just after `['). Return a pointer to the character past the 2073 * (just after `['). Return a pointer to the character past the