forked from Mirror/wren
- wrenGetArgumentCount() -> wrenGetSlotCount() - wrenGetArgument___() -> wrenGetSlot___() Also, the get functions assert that the value is the right type instead of checking at runtime. This puts the onus on the caller to be safe, but maximizes performance.
23 lines
461 B
C
23 lines
461 B
C
#include <string.h>
|
|
|
|
#include "benchmark.h"
|
|
|
|
static void arguments(WrenVM* vm)
|
|
{
|
|
double result = 0;
|
|
|
|
result += wrenGetSlotDouble(vm, 1);
|
|
result += wrenGetSlotDouble(vm, 2);
|
|
result += wrenGetSlotDouble(vm, 3);
|
|
result += wrenGetSlotDouble(vm, 4);
|
|
|
|
wrenReturnDouble(vm, result);
|
|
}
|
|
|
|
WrenForeignMethodFn benchmarkBindMethod(const char* signature)
|
|
{
|
|
if (strcmp(signature, "static Benchmark.arguments(_,_,_,_)") == 0) return arguments;
|
|
|
|
return NULL;
|
|
}
|