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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [lang/] [natAbstractStringBuffer.cc] - Blame information for rev 867

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

Line No. Rev Author Line
1 758 jeremybenn
// natStringBuffer.cc - Implementation of java.lang.StringBuffer native methods.
2
 
3
/* Copyright (C) 2001, 2003  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
#include <gcj/cni.h>
13
#include <java/lang/AbstractStringBuffer.h>
14
 
15
java::lang::AbstractStringBuffer*
16
java::lang::AbstractStringBuffer::append (jint num)
17
{
18
  // Use an array large enough for "-2147483648"; i.e. 11 chars.
19
  jchar buffer[11];
20
  int i = _Jv_FormatInt (buffer+11, num);
21
  jint needed = count + i;
22
  ensureCapacity_unsynchronized (needed);
23
  jchar* dst = elements (value) + count;
24
  jchar* src = buffer+11-i;
25
  while (--i >= 0)
26
    *dst++ = *src++;
27
  count = needed;
28
  return this;
29
}
30
 
31
jboolean
32
java::lang::AbstractStringBuffer::regionMatches(jint toffset, jstring other)
33
{
34
  jint len = other->count;
35
  jchar *tptr = elements(value) + toffset;
36
  jchar *optr = JvGetStringChars(other);
37
  while (--len >= 0)
38
    if (*tptr++ != *optr++)
39
      return false;
40
  return true;
41
}

powered by: WebSVN 2.1.0

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