コード例 #1
0
ファイル: test_lloperation.py プロジェクト: Darriall/pypy
def test_llop_fold():
    assert llop.int_add(lltype.Signed, 10, 2) == 12
    assert llop.int_add(lltype.Signed, -6, -7) == -13
    S1 = lltype.GcStruct('S1', ('x', lltype.Signed), hints={'immutable': True})
    s1 = lltype.malloc(S1)
    s1.x = 123
    assert llop.getfield(lltype.Signed, s1, 'x') == 123
    S2 = lltype.GcStruct('S2', ('x', lltype.Signed))
    s2 = lltype.malloc(S2)
    s2.x = 123
    py.test.raises(TypeError, "llop.getfield(lltype.Signed, s2, 'x')")
コード例 #2
0
def test_llop_fold():
    assert llop.int_add(lltype.Signed, 10, 2) == 12
    assert llop.int_add(lltype.Signed, -6, -7) == -13
    S1 = lltype.GcStruct('S1', ('x', lltype.Signed), hints={'immutable': True})
    s1 = lltype.malloc(S1)
    s1.x = 123
    assert llop.getfield(lltype.Signed, s1, 'x') == 123
    S2 = lltype.GcStruct('S2', ('x', lltype.Signed))
    s2 = lltype.malloc(S2)
    s2.x = 123
    py.test.raises(TypeError, "llop.getfield(lltype.Signed, s2, 'x')")
コード例 #3
0
ファイル: test_lloperation.py プロジェクト: Darriall/pypy
 def llf(x, y):
     return llop.int_add(lltype.Signed, x, y)
コード例 #4
0
ファイル: test_removenoops.py プロジェクト: cimarieta/usp
 def f(x):
     i = llop.int_invert(lltype.Signed, x)
     i = llop.int_add(lltype.Signed, x, 1)
     return llop.int_neg(lltype.Signed, i)
コード例 #5
0
def int_add(space, n, m):
    return space.newint(llop.int_add(lltype.Signed, n, m))
コード例 #6
0
ファイル: test_removenoops.py プロジェクト: zielmicha/pypy
 def f(x):
     i = llop.int_invert(lltype.Signed, x)
     i = llop.int_add(lltype.Signed, x, 1)
     return llop.int_neg(lltype.Signed, i)
コード例 #7
0
ファイル: interp_intop.py プロジェクト: mozillazg/pypy
def int_add(space, n, m):
    return space.wrap(llop.int_add(lltype.Signed, n, m))
コード例 #8
0
ファイル: interp_intop.py プロジェクト: sota/pypy-old
def int_add(space, n, m):
    return space.wrap(llop.int_add(lltype.Signed, n, m))
コード例 #9
0
 def llf(x, y):
     return llop.int_add(lltype.Signed, x, y)