/[classpath]/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
ViewVC logotype

Diff of /classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by rsdio, Sun Jul 31 00:59:03 2005 UTC revision 1.9 by glavaux, Wed Aug 3 09:05:51 2005 UTC
# Line 57  exception statement from your version. * Line 57  exception statement from your version. *
57    
58  /* FIXME these are defined in gnu_java_nio_channels_FileChannelImpl  /* FIXME these are defined in gnu_java_nio_channels_FileChannelImpl
59     too; should be someplace common. */     too; should be someplace common. */
60  #define ALIGN_DOWN(p,s) ((p) - ((p) % (s)))  #define ALIGN_DOWN(p,s) ((jpointer)(p) - ((jpointer)(p) % (s)))
61  #define ALIGN_UP(p,s) ((p) + ((s) - ((p) % (s))))  #define ALIGN_UP(p,s) ((jpointer)(p) + ((s) - ((jpointer)(p) % (s))))
62    
63  /**  /**
64   * Returns the memory page size of this platform.   * Returns the memory page size of this platform.
# Line 97  get_raw_values (JNIEnv *env, jobject thi Line 97  get_raw_values (JNIEnv *env, jobject thi
97    const long pagesize = get_pagesize ();    const long pagesize = get_pagesize ();
98    jfieldID MappedByteBufferImpl_address;    jfieldID MappedByteBufferImpl_address;
99    jfieldID MappedByteBufferImpl_size;    jfieldID MappedByteBufferImpl_size;
   jfieldID RawData_data;  
100    jobject MappedByteBufferImpl_address_value = NULL;    jobject MappedByteBufferImpl_address_value = NULL;
101    
102    *address = NULL;    *address = NULL;
# Line 123  get_raw_values (JNIEnv *env, jobject thi Line 122  get_raw_values (JNIEnv *env, jobject thi
122        return;        return;
123      }      }
124    
 #if (SIZEOF_VOID_P == 4)  
   RawData_data =  
     (*env)->GetFieldID (env, (*env)->GetObjectClass (env, MappedByteBufferImpl_address_value),  
                         "data", "I");  
125    *address = (void *)    *address = (void *)
126      ALIGN_DOWN ((*env)->GetIntField (env, MappedByteBufferImpl_address_value,      ALIGN_DOWN (JCL_GetRawData (env, MappedByteBufferImpl_address_value), pagesize);
                                      RawData_data), pagesize);  
 #elif (SIZEOF_VOID_P == 8)  
   RawData_data =  
     (*env)->GetFieldID (env, (*env)->GetObjectClass (env, MappedByteBufferImpl_address_value),  
                         "data", "J");  
   *address = (void *)  
     ALIGN_DOWN ((*env)->GetLongField (env, MappedByteBufferImpl_address_value,  
                                       RawData_data), pagesize);  
 #endif /* SIZEOF_VOID_P */  
   
127    *size = (size_t)    *size = (size_t)
128      ALIGN_UP ((*env)->GetIntField (env, this, MappedByteBufferImpl_size),      ALIGN_UP ((*env)->GetIntField (env, this, MappedByteBufferImpl_size),
129                pagesize);                pagesize);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26