Commit 55d5d340 authored by Stefan Behnel's avatar Stefan Behnel

Avoid stdint types to make MSVC happy.

parent f670c79b
...@@ -81,7 +81,6 @@ called = [] ...@@ -81,7 +81,6 @@ called = []
######## pkg/user.pxd ######## ######## pkg/user.pxd ########
from libc.stdint cimport *
from .registers cimport Registers, SubRegisters from .registers cimport Registers, SubRegisters
cdef class UseRegisters: cdef class UseRegisters:
...@@ -96,66 +95,55 @@ cdef class UseRegisters: ...@@ -96,66 +95,55 @@ cdef class UseRegisters:
def __init__(self, reg_type=Registers): def __init__(self, reg_type=Registers):
self.registers = reg_type() self.registers = reg_type()
called.append("Before setFullFlags") called.append("Before setFullFlags")
self.registers.setFullFlags(<uint32_t>0xffffffff, <uint32_t>0) self.registers.setFullFlags(<unsigned int>12345, <unsigned int>0)
called.append("After setFullFlags") called.append("After setFullFlags")
def call_write(self): def call_write(self):
called.append("Before regWriteWithOpWords") called.append("Before regWriteWithOpWords")
self.registers.regWriteWithOpWords(0, <uint32_t>0) self.registers.regWriteWithOpWords(0, <unsigned int>0)
called.append("After regWriteWithOpWords") called.append("After regWriteWithOpWords")
def call_non_fused(self): def call_non_fused(self):
called.append("Before nonFusedMiddle") called.append("Before nonFusedMiddle")
self.registers.nonFusedMiddle(0, <uint32_t>0) self.registers.nonFusedMiddle(0, <unsigned int>0)
called.append("After nonFusedMiddle") called.append("After nonFusedMiddle")
called.append("Before nonFusedBottom") called.append("Before nonFusedBottom")
self.registers.nonFusedBottom(0, <uint32_t>0) self.registers.nonFusedBottom(0, <unsigned int>0)
called.append("After nonFusedBottom") called.append("After nonFusedBottom")
called.append("Before nonFusedTop") called.append("Before nonFusedTop")
self.registers.nonFusedTop(0, <uint32_t>0) self.registers.nonFusedTop(0, <unsigned int>0)
called.append("After nonFusedTop") called.append("After nonFusedTop")
def call_sub(self): def call_sub(self):
assert isinstance(self.registers, SubRegisters), type(self.registers) assert isinstance(self.registers, SubRegisters), type(self.registers)
called.append("Before nonFusedSub") called.append("Before nonFusedSub")
(<SubRegisters>self.registers).nonFusedSub(0, <uint32_t>0) (<SubRegisters>self.registers).nonFusedSub(0, <unsigned int>0)
called.append("After nonFusedSub") called.append("After nonFusedSub")
called.append("Before fusedSub") called.append("Before fusedSub")
(<SubRegisters>self.registers).fusedSub(0, <uint32_t>0) (<SubRegisters>self.registers).fusedSub(0, <unsigned int>0)
called.append("After fusedSub") called.append("After fusedSub")
######## pkg/registers.pxd ######## ######## pkg/registers.pxd ########
from libc.stdint cimport * from cython cimport integral
cdef:
ctypedef fused uint8_t_uint16_t_uint32_t:
uint8_t
uint16_t
uint32_t
ctypedef fused uint16_t_uint32_t_uint64_t:
uint16_t
uint32_t
uint64_t
cdef class Registers: cdef class Registers:
cdef uint64_t regs[1] cdef unsigned long long regs[1]
cdef void nonFusedTop(self, uint16_t regId, uint32_t value) cdef void nonFusedTop(self, unsigned short regId, unsigned int value)
cdef void regWriteWithOpWords(self, uint16_t regId, uint16_t_uint32_t_uint64_t value) cdef void regWriteWithOpWords(self, unsigned short regId, integral value)
cdef void nonFusedMiddle(self, uint16_t regId, uint32_t value) cdef void nonFusedMiddle(self, unsigned short regId, unsigned int value)
cdef void setFullFlags(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1) cdef void setFullFlags(self, integral reg0, unsigned int reg1)
cdef void nonFusedBottom(self, uint16_t regId, uint32_t value) cdef void nonFusedBottom(self, unsigned short regId, unsigned int value)
cdef void lastFusedImplFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1) cdef void lastFusedImplFirst(self, integral reg0, unsigned int reg1)
cdef class SubRegisters(Registers): cdef class SubRegisters(Registers):
cdef void fusedSub(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1) cdef void fusedSub(self, integral reg0, unsigned int reg1)
cdef void nonFusedSub(self, uint16_t regId, uint32_t value) cdef void nonFusedSub(self, unsigned short regId, unsigned int value)
######## pkg/registers.pyx ######## ######## pkg/registers.pyx ########
...@@ -166,32 +154,32 @@ cdef class Registers: ...@@ -166,32 +154,32 @@ cdef class Registers:
def __init__(self): def __init__(self):
pass pass
cdef void lastFusedImplFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1): cdef void lastFusedImplFirst(self, integral reg0, unsigned int reg1):
called.append("lastFusedImplFirst was called") called.append("lastFusedImplFirst was called")
cdef void nonFusedTop(self, uint16_t regId, uint32_t value): cdef void nonFusedTop(self, unsigned short regId, unsigned int value):
called.append("nonFusedTop was called") called.append("nonFusedTop was called")
cdef void regWriteWithOpWords(self, uint16_t regId, uint16_t_uint32_t_uint64_t value): cdef void regWriteWithOpWords(self, unsigned short regId, integral value):
called.append("regWriteWithOpWords was called") called.append("regWriteWithOpWords was called")
self.regs[regId] = value self.regs[regId] = value
called.append("regWriteWithOpWords leave function") called.append("regWriteWithOpWords leave function")
cdef void nonFusedMiddle(self, uint16_t regId, uint32_t value): cdef void nonFusedMiddle(self, unsigned short regId, unsigned int value):
called.append("nonFusedMiddle was called") called.append("nonFusedMiddle was called")
cdef void setFullFlags(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1): cdef void setFullFlags(self, integral reg0, unsigned int reg1):
called.append("setFullFlags was called") called.append("setFullFlags was called")
cdef void nonFusedBottom(self, uint16_t regId, uint32_t value): cdef void nonFusedBottom(self, unsigned short regId, unsigned int value):
called.append("nonFusedBottom was called") called.append("nonFusedBottom was called")
cdef class SubRegisters(Registers): cdef class SubRegisters(Registers):
cdef void fusedSub(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1): cdef void fusedSub(self, integral reg0, unsigned int reg1):
called.append("fusedSub was called") called.append("fusedSub was called")
cdef void nonFusedSub(self, uint16_t regId, uint32_t value): cdef void nonFusedSub(self, unsigned short regId, unsigned int value):
called.append("nonFusedSub was called") called.append("nonFusedSub was called")
...@@ -200,9 +188,9 @@ cdef class SubRegisters(Registers): ...@@ -200,9 +188,9 @@ cdef class SubRegisters(Registers):
from .registers cimport * from .registers cimport *
cdef class SubSubRegisters(SubRegisters): cdef class SubSubRegisters(SubRegisters):
cdef void fusedSubSubFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1) cdef void fusedSubSubFirst(self, integral reg0, unsigned int reg1)
cdef void nonFusedSubSub(self, uint16_t regId, uint32_t value) cdef void nonFusedSubSub(self, unsigned short regId, unsigned int value)
cdef void fusedSubSubLast(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1) cdef void fusedSubSubLast(self, integral reg0, unsigned int reg1)
######## pkg/sub.pyx ######## ######## pkg/sub.pyx ########
...@@ -210,11 +198,11 @@ cdef class SubSubRegisters(SubRegisters): ...@@ -210,11 +198,11 @@ cdef class SubSubRegisters(SubRegisters):
from . import called from . import called
cdef class SubSubRegisters(SubRegisters): cdef class SubSubRegisters(SubRegisters):
cdef void fusedSubSubFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1): cdef void fusedSubSubFirst(self, integral reg0, unsigned int reg1):
called.append("fusedSubSubFirst was called") called.append("fusedSubSubFirst was called")
cdef void nonFusedSubSub(self, uint16_t regId, uint32_t value): cdef void nonFusedSubSub(self, unsigned short regId, unsigned int value):
called.append("nonFusedSubSub was called") called.append("nonFusedSubSub was called")
cdef void fusedSubSubLast(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1): cdef void fusedSubSubLast(self, integral reg0, unsigned int reg1):
called.append("fusedSubSubLast was called") called.append("fusedSubSubLast was called")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment