Пример #1
0
def simple_unary_op(func):
    specialize.argtype(1)(func)

    @functools.wraps(func)
    def dispatcher(self, v):
        return self.box(func(self, self.for_computation(self.unbox(v))))

    return dispatcher
Пример #2
0
def raw_binary_op(func):
    specialize.argtype(1, 2)(func)
    @functools.wraps(func)
    def dispatcher(self, v1, v2):
        return func(self,
            self.for_computation(self.unbox(v1)),
            self.for_computation(self.unbox(v2))
        )
    return dispatcher
Пример #3
0
def raw_unary_op(func):
    specialize.argtype(1)(func)
    @functools.wraps(func)
    def dispatcher(self, v):
        return func(
            self,
            self.for_computation(self.unbox(v))
        )
    return dispatcher
Пример #4
0
def raw_binary_op(func):
    specialize.argtype(1, 2)(func)

    @functools.wraps(func)
    def dispatcher(self, v1, v2):
        return func(self, self.for_computation(self.unbox(v1)),
                    self.for_computation(self.unbox(v2)))

    return dispatcher
Пример #5
0
def make_float_unpacker(size):
    return specialize.argtype(0)(
        lambda fmtiter: fmtiter.appendobj(ieee.unpack_float(
        fmtiter.read(size),
        fmtiter.bigendian)))
Пример #6
0
def make_float_unpacker(size):
    return specialize.argtype(0)(lambda fmtiter: fmtiter.appendobj(
        ieee.unpack_float(fmtiter.read(size), fmtiter.bigendian)))