| 1 |
|
| 2 |
from rpython.rtyper.lltypesystem import lltype |
| 3 |
from rpython.rtyper.lltypesystem.llmemory import cast_ptr_to_adr, raw_memclear,\ |
| 4 |
raw_memcopy, sizeof, itemoffsetof |
| 5 |
|
| 6 |
TP = lltype.GcArray(lltype.Signed) |
| 7 |
|
| 8 |
def longername(a, b, size): |
| 9 |
if 1: |
| 10 |
baseofs = itemoffsetof(TP, 0) |
| 11 |
onesize = sizeof(TP.OF) |
| 12 |
size = baseofs + onesize*(size - 1) |
| 13 |
raw_memcopy(cast_ptr_to_adr(b)+baseofs, cast_ptr_to_adr(a)+baseofs, size) |
| 14 |
else: |
| 15 |
a = [] |
| 16 |
for i in range(x): |
| 17 |
a.append(i) |
| 18 |
return 0 |
| 19 |
longername._dont_inline_ = True |
| 20 |
|
| 21 |
def entry_point(argv): |
| 22 |
size = int(argv[1]) |
| 23 |
a = lltype.malloc(TP, size) |
| 24 |
b = lltype.malloc(TP, size, zero=False) |
| 25 |
for i in range(size): |
| 26 |
a[i] = i |
| 27 |
print longername(a, b, size) |
| 28 |
return 0 |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
def target(*args): |
| 33 |
return entry_point, None |
| 34 |
|
| 35 |
if __name__ == '__main__': |
| 36 |
import sys |
| 37 |
entry_point(sys.argv) |