From: Bill Zorn Date: Wed, 5 Sep 2018 21:21:55 +0000 (-0700) Subject: don't use quire clear macros, hopefully for windows compatibility X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5a0ff777c022e816a5666272d9d6d9b327aed750;p=sfpy.git don't use quire clear macros, hopefully for windows compatibility --- diff --git a/sfpy/cposit.pxd b/sfpy/cposit.pxd index 91575b7..2475537 100644 --- a/sfpy/cposit.pxd +++ b/sfpy/cposit.pxd @@ -113,7 +113,8 @@ cdef extern from '../SoftPosit/source/include/softposit.h': bint isNaRQ8( quire8_t ); bint isQ8Zero( quire8_t ); - quire8_t q8_clr( quire8_t ); + #quire8_t q8_clr( quire8_t ); + quire8_t q8Clr(); quire8_t castQ8( uint32_t ); posit8_t castP8( uint8_t ); uint8_t castUI8( posit8_t ); @@ -161,7 +162,8 @@ cdef extern from '../SoftPosit/source/include/softposit.h': # void printBinary( uint64_t*, int ); # void printHex( uint64_t ); - quire16_t q16_clr( quire16_t ); + #quire16_t q16_clr( quire16_t ); + quire16_t q16Clr(); quire16_t castQ16( uint16_t, uint16_t ); posit16_t castP16( uint16_t ); uint16_t castUI16( posit16_t ); @@ -204,7 +206,7 @@ cdef extern from '../SoftPosit/source/include/softposit.h': bint isNaRQ32( quire32_t ); bint isQ32Zero( quire32_t ); quire32_t q32_TwosComplement( quire32_t ); - quire32_t q32_clr( quire32_t ); + #quire32_t q32_clr( quire32_t ); quire32_t q32Clr(); quire32_t castQ32( uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t ); posit32_t castP32( uint32_t ); diff --git a/sfpy/posit.pyx b/sfpy/posit.pyx index 01b35be..1725cc2 100644 --- a/sfpy/posit.pyx +++ b/sfpy/posit.pyx @@ -240,7 +240,7 @@ cdef class Posit8: cpdef to_quire(self): cdef cposit.quire8_t f - f = cposit.q8_clr(f) + f = cposit.q8Clr() f = cposit.q8_fdp_add(f, self._c_posit, _p8_one) return Quire8.from_c_quire(f) @@ -281,7 +281,7 @@ cdef class Quire8: self._c_quire.v = value else: f = float(value) - self._c_quire = cposit.q8_clr(self._c_quire) + self._c_quire = cposit.q8Clr() self._c_quire = cposit.q8_fdp_add(self._c_quire, cposit.convertDoubleToP8(f), _p8_one) def __float__(self): @@ -317,7 +317,7 @@ cdef class Quire8: self._c_quire = cposit.q8_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) cpdef void iclr(self): - self._c_quire = cposit.q8_clr(self._c_quire) + self._c_quire = cposit.q8Clr() # conversion back to posit @@ -383,7 +383,7 @@ cpdef Posit32 p8_to_p32(Posit8 a1): cpdef Quire8 p8_to_q8(Posit8 a1): cdef cposit.quire8_t f - f = cposit.q8_clr(f) + f = cposit.q8Clr() f = cposit.q8_fdp_add(f, a1._c_posit, _p8_one) return Quire8.from_c_quire(f) @@ -607,7 +607,7 @@ cdef class Posit16: cpdef to_quire(self): cdef cposit.quire16_t f - f = cposit.q16_clr(f) + f = cposit.q16Clr() f = cposit.q16_fdp_add(f, self._c_posit, _p16_one) return Quire16.from_c_quire(f) @@ -662,7 +662,7 @@ cdef class Quire16: raise OverflowError('value too large to fit in uint64_t[2]') else: f = float(value) - self._c_quire = cposit.q16_clr(self._c_quire) + self._c_quire = cposit.q16Clr() self._c_quire = cposit.q16_fdp_add(self._c_quire, cposit.convertDoubleToP16(f), _p16_one) def __float__(self): @@ -702,7 +702,7 @@ cdef class Quire16: self._c_quire = cposit.q16_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) cpdef void iclr(self): - self._c_quire = cposit.q16_clr(self._c_quire) + self._c_quire = cposit.q16Clr() # conversion back to posit @@ -768,7 +768,7 @@ cpdef Posit32 p16_to_p32(Posit16 a1): cpdef Quire16 p16_to_q16(Posit16 a1): cdef cposit.quire16_t f - f = cposit.q16_clr(f) + f = cposit.q16Clr() f = cposit.q16_fdp_add(f, a1._c_posit, _p16_one) return Quire16.from_c_quire(f) @@ -992,7 +992,7 @@ cdef class Posit32: cpdef to_quire(self): cdef cposit.quire32_t f - f = cposit.q32_clr(f) + f = cposit.q32Clr() f = cposit.q32_fdp_add(f, self._c_posit, _p32_one) return Quire32.from_c_quire(f) @@ -1047,7 +1047,7 @@ cdef class Quire32: raise OverflowError('value too large to fit in uint64_t[8]') else: f = float(value) - self._c_quire = cposit.q32_clr(self._c_quire) + self._c_quire = cposit.q32Clr() self._c_quire = cposit.q32_fdp_add(self._c_quire, cposit.convertDoubleToP32(f), _p32_one) def __float__(self): @@ -1087,7 +1087,7 @@ cdef class Quire32: self._c_quire = cposit.q32_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) cpdef void iclr(self): - self._c_quire = cposit.q32_clr(self._c_quire) + self._c_quire = cposit.q32Clr() # conversion back to posit @@ -1153,7 +1153,7 @@ cpdef Posit16 p32_to_p16(Posit32 a1): cpdef Quire32 p32_to_q32(Posit32 a1): cdef cposit.quire32_t f - f = cposit.q32_clr(f) + f = cposit.q32Clr() f = cposit.q32_fdp_add(f, a1._c_posit, _p32_one) return Quire32.from_c_quire(f)