summaryrefslogtreecommitdiffstats
path: root/awlsim/core/offset.pxd.in
blob: f7808fdf5bed5d0f536a30312229ef9586193b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from awlsim.common.cython_support cimport *

cimport cython


cdef class AwlOffset(object):
	cdef public int64_t byteOffset
	cdef public int32_t bitOffset

	cdef public int32_t dbNumber
	cdef public object dbName
	cdef public object identChain
	cdef public int32_t fbNumber
	cdef public AwlOffset subOffset

	cpdef __eq(self, object other)

	cpdef AwlOffset dup(self)

	cpdef uint32_t toPointerValue(self)
	cpdef uint64_t toLongBitOffset(self)

	cdef AwlOffset add(self, AwlOffset other)
	cdef AwlOffset addInt(self, int64_t byteOffset, int32_t bitOffset)

	cdef void iadd(self, AwlOffset other)
	cdef void iaddInt(self, int64_t byteOffset, int32_t bitOffset)

cdef AwlOffset make_AwlOffset(int64_t byteOffset, int32_t bitOffset)

cdef inline AwlOffset make_AwlOffset_fromPointerValue(uint32_t value):
	return make_AwlOffset((value & 0x0007FFF8u) >> 3u,
			      (value & 0x7u))

@cython.cdivision(True)
cdef inline AwlOffset make_AwlOffset_fromLongBitOffset(int64_t bitOffset):
	return make_AwlOffset(bitOffset // 8, bitOffset % 8)
bues.ch cgit interface