diff options
author | TechnoPorg <jonah.janzen@gmail.com> | 2022-10-22 12:01:00 -0600 |
---|---|---|
committer | TechnoPorg <jonah.janzen@gmail.com> | 2022-11-08 07:27:45 -0700 |
commit | df4597c9abf8657c16fdc4f9079e07b1684965f3 (patch) | |
tree | 02f2dae6cc570c074c6c9f34a7b9b930d32504b1 /platform/android/api | |
parent | a499f7bdc4be5877c75bd898e040937a02b99b85 (diff) |
Improve support for 64-bit types on Android.
This update mappings in the JNI functions to better support 64-bit integers, and adds support for 64-bit float arrays.
The code is mostly reused from 32-bit types.
Diffstat (limited to 'platform/android/api')
-rw-r--r-- | platform/android/api/jni_singleton.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/platform/android/api/jni_singleton.h b/platform/android/api/jni_singleton.h index 895bc70103..afe7dcaeff 100644 --- a/platform/android/api/jni_singleton.h +++ b/platform/android/api/jni_singleton.h @@ -137,6 +137,18 @@ public: ret = sarr; env->DeleteLocalRef(arr); } break; + case Variant::PACKED_INT64_ARRAY: { + jlongArray arr = (jlongArray)env->CallObjectMethodA(instance, E->get().method, v); + + int fCount = env->GetArrayLength(arr); + Vector<int64_t> sarr; + sarr.resize(fCount); + + int64_t *w = sarr.ptrw(); + env->GetLongArrayRegion(arr, 0, fCount, w); + ret = sarr; + env->DeleteLocalRef(arr); + } break; case Variant::PACKED_FLOAT32_ARRAY: { jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance, E->get().method, v); @@ -149,9 +161,18 @@ public: ret = sarr; env->DeleteLocalRef(arr); } break; + case Variant::PACKED_FLOAT64_ARRAY: { + jdoubleArray arr = (jdoubleArray)env->CallObjectMethodA(instance, E->get().method, v); - // TODO: This is missing 64 bits arrays, I have no idea how to do it in JNI. + int fCount = env->GetArrayLength(arr); + Vector<double> sarr; + sarr.resize(fCount); + double *w = sarr.ptrw(); + env->GetDoubleArrayRegion(arr, 0, fCount, w); + ret = sarr; + env->DeleteLocalRef(arr); + } break; case Variant::DICTIONARY: { jobject obj = env->CallObjectMethodA(instance, E->get().method, v); ret = _jobject_to_variant(env, obj); |