Rev 4990 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4990 | Rev 5069 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | // For storing pointers in files.
|
40 | // For storing pointers in files.
|
41 | // back_p==0: ptr -> "small int"
|
41 | // back_p==0: ptr -> "small int"
|
42 | // back_p==1: "small int" -> ptr
|
42 | // back_p==1: "small int" -> ptr
|
43 | //
|
43 | //
|
44 | // mode: see enum in savegame.h
|
44 | // mode: see enum in savegame.h
|
45 | void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode) |
45 | void G_Util_PtrToIdx(void *ptr, int32_t const count, const void *base, int32_t const mode) |
46 | {
|
46 | {
|
47 | intptr_t *iptr = (intptr_t *)ptr; |
47 | intptr_t *iptr = (intptr_t *)ptr; |
48 | intptr_t const ibase = (intptr_t)base; |
48 | intptr_t const ibase = (intptr_t)base; |
49 | int32_t const onlynon0_p = mode&P2I_ONLYNON0_BIT; |
49 | int32_t const onlynon0_p = mode&P2I_ONLYNON0_BIT; |
50 | 50 | ||
Line 65... | Line 65... | ||
65 | if (!onlynon0_p || iptr[i]) |
65 | if (!onlynon0_p || iptr[i]) |
66 | iptr[i] += ibase; |
66 | iptr[i] += ibase; |
67 | }
|
67 | }
|
68 | }
|
68 | }
|
69 | 69 | ||
70 | void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t mode) |
70 | void G_Util_PtrToIdx2(void *ptr, int32_t const count, size_t const stride, const void *base, int32_t const mode) |
71 | {
|
71 | {
|
72 | uint8_t *iptr = (uint8_t *)ptr; |
72 | uint8_t *iptr = (uint8_t *)ptr; |
73 | intptr_t const ibase = (intptr_t)base; |
73 | intptr_t const ibase = (intptr_t)base; |
74 | int32_t const onlynon0_p = mode&P2I_ONLYNON0_BIT; |
74 | int32_t const onlynon0_p = mode&P2I_ONLYNON0_BIT; |
75 | 75 |