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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-strslice.c] - Blame information for rev 772

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

Line No. Rev Author Line
1 747 jeremybenn
/* go-strslice.c -- the go string slice function.
2
 
3
   Copyright 2009 The Go Authors. All rights reserved.
4
   Use of this source code is governed by a BSD-style
5
   license that can be found in the LICENSE file.  */
6
 
7
#include "go-string.h"
8
#include "go-panic.h"
9
#include "runtime.h"
10
#include "arch.h"
11
#include "malloc.h"
12
 
13
struct __go_string
14
__go_string_slice (struct __go_string s, int start, int end)
15
{
16
  int len;
17
  struct __go_string ret;
18
 
19
  len = s.__length;
20
  if (end == -1)
21
    end = len;
22
  if (start > len || end < start || end > len)
23
    runtime_panicstring ("string index out of bounds");
24
  ret.__data = s.__data + start;
25
  ret.__length = end - start;
26
  return ret;
27
}

powered by: WebSVN 2.1.0

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