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

Avoid stdint types to make MSVC happy.

parent f670c79b
......@@ -81,7 +81,6 @@ called = []
######## pkg/user.pxd ########
from libc.stdint cimport *
from .registers cimport Registers, SubRegisters
cdef class UseRegisters:
......@@ -96,66 +95,55 @@ cdef class UseRegisters:
def __init__(self, reg_type=Registers):
self.registers = reg_type()
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")
def call_write(self):
called.append("Before regWriteWithOpWords")
self.registers.regWriteWithOpWords(0, <uint32_t>0)
self.registers.regWriteWithOpWords(0, <unsigned int>0)
called.append("After regWriteWithOpWords")
def call_non_fused(self):
called.append("Before nonFusedMiddle")
self.registers.nonFusedMiddle(0, <uint32_t>0)
self.registers.nonFusedMiddle(0, <unsigned int>0)
called.append("After nonFusedMiddle")
called.append("Before nonFusedBottom")
self.registers.nonFusedBottom(0, <uint32_t>0)
self.registers.nonFusedBottom(0, <unsigned int>0)
called.append("After nonFusedBottom")
called.append("Before nonFusedTop")
self.registers.nonFusedTop(0, <uint32_t>0)
self.registers.nonFusedTop(0, <unsigned int>0)
called.append("After nonFusedTop")
def call_sub(self):
assert isinstance(self.registers, SubRegisters), type(self.registers)
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("Before fusedSub")
(<SubRegisters>self.registers).fusedSub(0, <uint32_t>0)
(<SubRegisters>self.registers).fusedSub(0, <unsigned int>0)
called.append("After fusedSub")
######## pkg/registers.pxd ########
from libc.stdint cimport *
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
from cython cimport integral
cdef class Registers:
cdef uint64_t regs[1]
cdef void nonFusedTop(self, uint16_t regId, uint32_t value)
cdef void regWriteWithOpWords(self, uint16_t regId, uint16_t_uint32_t_uint64_t value)
cdef void nonFusedMiddle(self, uint16_t regId, uint32_t value)
cdef void setFullFlags(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1)
cdef void nonFusedBottom(self, uint16_t regId, uint32_t value)
cdef void lastFusedImplFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1)
cdef unsigned long long regs[1]
cdef void nonFusedTop(self, unsigned short regId, unsigned int value)
cdef void regWriteWithOpWords(self, unsigned short regId, integral value)
cdef void nonFusedMiddle(self, unsigned short regId, unsigned int value)
cdef void setFullFlags(self, integral reg0, unsigned int reg1)
cdef void nonFusedBottom(self, unsigned short regId, unsigned int value)
cdef void lastFusedImplFirst(self, integral reg0, unsigned int reg1)
cdef class SubRegisters(Registers):
cdef void fusedSub(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1)
cdef void nonFusedSub(self, uint16_t regId, uint32_t value)
cdef void fusedSub(self, integral reg0, unsigned int reg1)
cdef void nonFusedSub(self, unsigned short regId, unsigned int value)
######## pkg/registers.pyx ########
......@@ -166,32 +154,32 @@ cdef class Registers:
def __init__(self):
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")
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")
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")
self.regs[regId] = value
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")
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")
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")
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")
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")
......@@ -200,9 +188,9 @@ cdef class SubRegisters(Registers):
from .registers cimport *
cdef class SubSubRegisters(SubRegisters):
cdef void fusedSubSubFirst(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1)
cdef void nonFusedSubSub(self, uint16_t regId, uint32_t value)
cdef void fusedSubSubLast(self, uint8_t_uint16_t_uint32_t reg0, uint32_t reg1)
cdef void fusedSubSubFirst(self, integral reg0, unsigned int reg1)
cdef void nonFusedSubSub(self, unsigned short regId, unsigned int value)
cdef void fusedSubSubLast(self, integral reg0, unsigned int reg1)
######## pkg/sub.pyx ########
......@@ -210,11 +198,11 @@ cdef class SubSubRegisters(SubRegisters):
from . import called
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")
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")
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")
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