Skip to content

Commit ac4308e

Browse files
committed
Use correct type
In the main branch, the type of these fields was updated from 'int' to 'rtapi_intptr_t'. On 64-bit systems, this led to most HAL operations crashing.
1 parent 5d787ca commit ac4308e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/hal/hal_priv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,21 @@ class hal_shmfield {
162162
const T *operator ->() const { return get(); }
163163
operator bool() const { return off; }
164164
private:
165-
int off;
165+
rtapi_intptr_t off;
166166
};
167167

168168
template<class T>
169169
hal_shmfield<T> hal_make_shmfield(T *t) {
170170
return hal_shmfield<T>(t);
171171
}
172172

173-
static_assert(sizeof(hal_shmfield<void>) == sizeof(int), "hal_shmfield size matches");
173+
static_assert(sizeof(hal_shmfield<void>) == sizeof(rtapi_intptr_t), "hal_shmfield size matches");
174174

175175
#define SHMFIELD(type) hal_shmfield<type>
176176
#define SHMPTR(arg) ((arg).get())
177177
#define SHMOFF(ptr) (hal_make_shmfield(ptr))
178178
#else
179-
#define SHMFIELD(type) int
179+
#define SHMFIELD(type) rtapi_intptr_t
180180

181181
/* SHMPTR(offset) converts 'offset' to a void pointer. */
182182
#define SHMPTR(offset) ( (void *)( hal_shmem_base + (offset) ) )

0 commit comments

Comments
 (0)