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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-byte-array-to-string.c] - Blame information for rev 764

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

Line No. Rev Author Line
1 747 jeremybenn
/* go-byte-array-to-string.c -- convert an array of bytes to a string in Go.
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 "runtime.h"
9
#include "arch.h"
10
#include "malloc.h"
11
 
12
struct __go_string
13
__go_byte_array_to_string (const void* p, int len)
14
{
15
  const unsigned char *bytes;
16
  unsigned char *retdata;
17
  struct __go_string ret;
18
 
19
  bytes = (const unsigned char *) p;
20
  retdata = runtime_mallocgc (len, FlagNoPointers, 1, 0);
21
  __builtin_memcpy (retdata, bytes, len);
22
  ret.__data = retdata;
23
  ret.__length = len;
24
  return ret;
25
}

powered by: WebSVN 2.1.0

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