diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libToCString.c b/test/micro/org/openjdk/bench/java/lang/foreign/libToCString.c index 24c7e6f959b..1fae0325dbc 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/libToCString.c +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libToCString.c @@ -21,13 +21,14 @@ * questions. */ +#include #include #include #include JNIEXPORT jlong JNICALL Java_org_openjdk_bench_java_lang_foreign_ToCStringTest_writeString(JNIEnv *const env, const jclass cls, const jstring text) { const char *str = (*env)->GetStringUTFChars(env, text, NULL); - jlong addr = (jlong)(void*)str; + jlong addr = ptr_to_jlong(str); (*env)->ReleaseStringUTFChars(env, text, str); return addr; } diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libToJavaString.c b/test/micro/org/openjdk/bench/java/lang/foreign/libToJavaString.c index dff129dedf8..ed89320574d 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/libToJavaString.c +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libToJavaString.c @@ -23,10 +23,11 @@ * questions. */ +#include #include #include #include JNIEXPORT jstring JNICALL Java_org_openjdk_bench_java_lang_foreign_ToJavaStringTest_readString(JNIEnv *const env, const jclass cls, jlong addr) { - return (*env)->NewStringUTF(env, (char*)(void*)addr); + return (*env)->NewStringUTF(env, jlong_to_ptr(addr)); }