Bump MINIFFI_MAX_ARGS to 16 (#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 https://github.com/mkxp-z/mkxp-z/issues/2

* Bump MINIFFI_MAX_ARGS to 16
This commit is contained in:
Splendide Imaginarius 2022-12-21 10:25:15 +00:00 committed by GitHub
parent 368534fd1d
commit 3fc5bbe429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -2,11 +2,16 @@
#include <cstdint>
#define MINIFFI_MAX_ARGS 10l
#define MINIFFI_MAX_ARGS 16l
#if defined(__linux__) || defined(__APPLE__)
typedef unsigned long mffi_value;
// Be sure to add more args to the below line if MINIFFI_MAX_ARGS is bumped
// in the future.
typedef mffi_value (*MINIFFI_FUNC)(mffi_value, mffi_value,
mffi_value, mffi_value,
mffi_value, mffi_value,
mffi_value, mffi_value,
mffi_value, mffi_value,
mffi_value, mffi_value,
mffi_value, mffi_value,