Issue
I have a jni function
native float nativeMethod(int num);
That ties to a C function
void Java_com_package_name_nativeMethod(JNIEnv * env, jobject obj, jint num)
{
unsigned int nativeUnsignedNum = num;
}
And my C code requires the use of unsigned integers. How can I make this work? Using the code above I get an error: Using 'unsigned int' for signed values of type 'jint'
. How can I pass a number ( it will always unsigned/positive ) from Java to a C method, and assign this value to an unsigned integer?
Thanks!
Solution
Cast it:
unsigned int nativeUnsignedNum = (unsigned int)num;
Answered By - PerracoLabs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.