Skip to content

Commit 3fc5bbe

Browse files
Bump MINIFFI_MAX_ARGS to 16 (mkxp-z#4)
* MiniFFI: Use MINIFFI_MAX_ARGS instead of literal * MiniFFI: Document lines that need changing if MINIFFI_MAX_ARGS changes * Bump MINIFFI_MAX_ARGS to 12 Fixes mkxp-z#2 * Bump MINIFFI_MAX_ARGS to 16
1 parent 368534f commit 3fc5bbe

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

binding/miniffi.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
#if defined(__MINGW64__) || defined(__linux__) || defined(__APPLE__)
55
mffi_value miniffi_call_intern(MINIFFI_FUNC target, MiniFFIFuncArgs *p, int nparams) {
6-
assert(nparams <= 10);
6+
assert(nparams <= MINIFFI_MAX_ARGS);
7+
// Be sure to add more args to the below line if MINIFFI_MAX_ARGS is bumped
8+
// in the future.
79
return target(p->params[0], p->params[1], p->params[2], p->params[3],
810
p->params[4], p->params[5], p->params[6],
9-
p->params[7], p->params[8], p->params[9]);
11+
p->params[7], p->params[8], p->params[9],
12+
p->params[10], p->params[11], p->params[12],
13+
p->params[13], p->params[14], p->params[15]);
1014
}
1115
#else // 32-bit Windows
1216
#define INTEL_ASM ".intel_syntax noprefix\n"

binding/miniffi.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
#include <cstdint>
44

5-
#define MINIFFI_MAX_ARGS 10l
5+
#define MINIFFI_MAX_ARGS 16l
66

77
#if defined(__linux__) || defined(__APPLE__)
88
typedef unsigned long mffi_value;
9+
// Be sure to add more args to the below line if MINIFFI_MAX_ARGS is bumped
10+
// in the future.
911
typedef mffi_value (*MINIFFI_FUNC)(mffi_value, mffi_value,
12+
mffi_value, mffi_value,
13+
mffi_value, mffi_value,
14+
mffi_value, mffi_value,
1015
mffi_value, mffi_value,
1116
mffi_value, mffi_value,
1217
mffi_value, mffi_value,

0 commit comments

Comments
 (0)