aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library.js6
-rw-r--r--src/runtime.js4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/library.js b/src/library.js
index 28724c0c..d276f216 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2499,7 +2499,7 @@ LibraryManager.library = {
for (var formatIndex = 0; formatIndex < format.length;) {
if (format[formatIndex] === '%' && format[formatIndex+1] == 'n') {
var argPtr = {{{ makeGetValue('varargs', 'argIndex', 'void*') }}};
- argIndex += Runtime.getAlignSize('void*');
+ argIndex += Runtime.getAlignSize('void*', null, true);
{{{ makeSetValue('argPtr', 0, 'soFar', 'i32') }}};
formatIndex += 2;
continue;
@@ -2508,7 +2508,7 @@ LibraryManager.library = {
// TODO: Support strings like "%5c" etc.
if (format[formatIndex] === '%' && format[formatIndex+1] == 'c') {
var argPtr = {{{ makeGetValue('varargs', 'argIndex', 'void*') }}};
- argIndex += Runtime.getAlignSize('void*');
+ argIndex += Runtime.getAlignSize('void*', null, true);
fields++;
next = get();
{{{ makeSetValue('argPtr', 0, 'next', 'i8') }}}
@@ -2600,7 +2600,7 @@ LibraryManager.library = {
var text = buffer.join('');
var argPtr = {{{ makeGetValue('varargs', 'argIndex', 'void*') }}};
- argIndex += Runtime.getAlignSize('void*');
+ argIndex += Runtime.getAlignSize('void*', null, true);
switch (type) {
case 'd': case 'u': case 'i':
if (half) {
diff --git a/src/runtime.js b/src/runtime.js
index d023d409..db334669 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -176,10 +176,10 @@ var Runtime = {
STACK_ALIGN: {{{ STACK_ALIGN }}},
// type can be a native type or a struct (or null, for structs we only look at size here)
- getAlignSize: function(type, size) {
+ getAlignSize: function(type, size, vararg) {
// we align i64s and doubles on 64-bit boundaries, unlike x86
#if TARGET_LE32
- if (type == 'i64' || type == 'double') return 8;
+ if (type == 'i64' || type == 'double' || vararg) return 8;
#endif
return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
},