/* Functions related to the RngStream Java port */
-/* Copyright (c) 2007-2012 The SimGrid Team.
+/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
+ * under the terms of the license (GNU LGPL) which comes with this package. */
#include "jmsg_rngstream.h"
#include "jxbt_utilities.h"
jfieldID jrngstream_bind;
RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
- RngStream rngstream = (RngStream) (*env)->GetLongField(env, jrngstream, jrngstream_bind);
+ RngStream rngstream =
+ (RngStream)(intptr_t)(*env)->GetLongField(env, jrngstream, jrngstream_bind);
if (!rngstream) {
jxbt_throw_notbound(env, "rngstream", jrngstream);
return NULL;
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
RngStream rngstream = RngStream_CreateStream(name);
//Bind the RngStream object
- (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)rngstream);
+ (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)rngstream);
(*env)->ReleaseStringUTFChars(env, jname, name);
}
Java_org_simgrid_msg_RngStream_destroy(JNIEnv *env, jobject jrngstream) {
RngStream rngstream = jrngstream_to_native(env, jrngstream);
RngStream_DeleteStream(&rngstream);
- (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)NULL);
+ (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)NULL);
}
JNIEXPORT jboolean JNICALL
Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv *env, jobject jrngstream, jintArray jseed) {