--- /dev/null
+from libc.stdint cimport *
+
+cdef extern from 'SoftPosit/source/include/softposit.h':
+
+ ctypedef struct posit8_t:
+ pass
+
+ posit8_t i64_to_p8( int64_t );
+ int_fast64_t p8_to_i64( posit8_t);
--- /dev/null
+cimport cposit
+
+cdef class Posit8:
+ cdef cposit.posit8_t _c_posit
+
+ def __cinit__(self):
+ self._c_posit = cposit.i64_to_p8(1)
+
+ cpdef show(self):
+ print(cposit.p8_to_i64(self._c_posit))
+
--- /dev/null
+from distutils.core import setup
+from distutils.extension import Extension
+from Cython.Build import cythonize
+
+ext = Extension('posit', ['posit.pyx'],
+ include_dirs=['SoftPosit/source/include/'],
+ extra_objects=['./SoftPosit/build/Linux-x86_64-GCC/softposit.a'],
+ libraries=['m'],
+)
+
+setup(
+ name='sfpy',
+ ext_modules=cythonize([ext]),
+)