aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManuel Wellmann <manuel.wellmann@autodesk.com>2012-10-18 11:06:15 +0200
committerManuel Wellmann <manuel.wellmann@autodesk.com>2012-11-05 18:00:29 +0100
commit1365ac6abc04af43100cfa5b763ee81412af76a0 (patch)
treee87a41e3cc7e5abdf259c72955e087217b30af0f /src
parent1687c90b286d2e7c1fe1aa2acfa68397a4dfacfb (diff)
Added %lld support to __scanString
Also extended makeSetValue for the i64/typed_array=2 case.
Diffstat (limited to 'src')
-rw-r--r--src/library.js11
-rw-r--r--src/parseTools.js4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index 207d6e39..c3f7c600 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2434,7 +2434,7 @@ LibraryManager.library = {
__scanString.whiteSpace['\t'] = 1;
__scanString.whiteSpace['\n'] = 1;
}
- // Supports %x, %4x, %d.%d, %s, %f, %lf.
+ // Supports %x, %4x, %d.%d, %lld, %s, %f, %lf.
// TODO: Support all format specifiers.
format = Pointer_stringify(format);
var soFar = 0;
@@ -2485,9 +2485,14 @@ LibraryManager.library = {
}
var long_ = false;
var half = false;
+ var longLong = false;
if (format[formatIndex] == 'l') {
long_ = true;
formatIndex++;
+ if(format[formatIndex] == 'l') {
+ longLong = true;
+ formatIndex++;
+ }
} else if (format[formatIndex] == 'h') {
half = true;
formatIndex++;
@@ -2498,7 +2503,7 @@ LibraryManager.library = {
var buffer = [];
// Read characters according to the format. floats are trickier, they may be in an unfloat state in the middle, then be a valid float later
if (type == 'f') {
- var last = -1;
+ var last = 0;
while (next > 0) {
buffer.push(String.fromCharCode(next));
if (__isFloat(buffer.join(''))) {
@@ -2539,6 +2544,8 @@ LibraryManager.library = {
case 'd': case 'u': case 'i':
if (half) {
{{{ makeSetValue('argPtr', 0, 'parseInt(text, 10)', 'i16') }}};
+ } else if(longLong) {
+ {{{ makeSetValue('argPtr', 0, 'parseInt(text, 10)', 'i64') }}};
} else {
{{{ makeSetValue('argPtr', 0, 'parseInt(text, 10)', 'i32') }}};
}
diff --git a/src/parseTools.js b/src/parseTools.js
index 5d7420ef..2cdea7c0 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1005,6 +1005,10 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
return '(tempDoubleF64[0]=' + value + ',' +
makeSetValue(ptr, pos, 'tempDoubleI32[0]', 'i32', noNeedFirst, ignore, align, noSafe, ',') + ',' +
makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'tempDoubleI32[1]', 'i32', noNeedFirst, ignore, align, noSafe, ',') + ')';
+ } else if (USE_TYPED_ARRAYS == 2 && type == 'i64') {
+ return '(tempI64 = [' + splitI64(value) + '],' +
+ makeSetValue(ptr, pos, 'tempI64[0]', 'i32', noNeedFirst, ignore, align, noSafe, ',') + ',' +
+ makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'tempI64[1]', 'i32', noNeedFirst, ignore, align, noSafe, ',') + ')';
}
var bits = getBits(type);