OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [nio/] [natVMDirectByteBufferImpl.cc] - Blame information for rev 780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 758 jeremybenn
// natDirectByteBufferImpl.cc
2
 
3
/* Copyright (C) 2003, 2004  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
#include <config.h>
12
 
13
#include <gcj/cni.h>
14
#include <jvm.h>
15
 
16
#include <stdlib.h>
17
 
18
#include <gnu/gcj/RawData.h>
19
#include <java/nio/VMDirectByteBuffer.h>
20
 
21
using gnu::gcj::RawData;
22
 
23
RawData*
24
java::nio::VMDirectByteBuffer::allocate (jint capacity)
25
{
26
  return reinterpret_cast<gnu::gcj::RawData*> (::malloc (capacity));
27
}
28
 
29
void
30
java::nio::VMDirectByteBuffer::free (gnu::gcj::RawData* address)
31
{
32
  ::free (reinterpret_cast<void*> (address));
33
}
34
 
35
jbyte
36
java::nio::VMDirectByteBuffer::get (RawData* address, jint index)
37
{
38
  jbyte* pointer = reinterpret_cast<jbyte*> (address) + index;
39
  return *pointer;
40
}
41
 
42
void
43
java::nio::VMDirectByteBuffer::get (RawData* address, jint index,
44
                                    jbyteArray dst, jint offset, jint length)
45
{
46
  jbyte* src = reinterpret_cast<jbyte*> (address) + index;
47
  memcpy (elements (dst) + offset, src, length);
48
}
49
 
50
void
51
java::nio::VMDirectByteBuffer::put (gnu::gcj::RawData* address,
52
                                    jint index, jbyte value)
53
{
54
  jbyte* pointer = reinterpret_cast<jbyte*> (address) + index;
55
  *pointer = value;
56
}
57
 
58
RawData*
59
java::nio::VMDirectByteBuffer::adjustAddress (RawData* address, jint offset)
60
{
61
  jbyte* start = reinterpret_cast<jbyte*> (address) + offset;
62
  return reinterpret_cast<RawData*>(start);
63
}
64
 
65
void
66
java::nio::VMDirectByteBuffer::shiftDown (RawData* address, jint dst_offset,
67
                                          jint src_offset, jint count)
68
{
69
  jbyte* dst = reinterpret_cast<jbyte*> (address) + dst_offset;
70
  jbyte* src = reinterpret_cast<jbyte*> (address) + src_offset;
71
  ::memmove(dst, src, count);
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.