Offload int[] to byte[].
[SquirrelJME.git] / nanocoat / frontend / emulator / nativeAllocSizeOf.c
blobd84a5c09abd61021d4154eee651bd2577ae2a9d4
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 #include <jni.h>
12 #include "sjme/nvm/allocSizeOf.h"
13 #include "frontend/emulator/jniHelper.h"
15 jint SJME_JNI_METHOD(SJME_CLASS_ALLOC_SIZEOF, _1_1size)
16 (JNIEnv* env, jclass classy, jint id, jint count)
18 sjme_jint result;
19 sjme_errorCode error;
21 /* Calculate the size. */
22 result = -1;
23 if (sjme_error_is(error = sjme_alloc_sizeOf(id, count, &result)) ||
24 id < 0)
26 sjme_jni_throwVMException(env, error);
27 return -1;
30 /* Use the given result. */
31 return result;