Skip to content

Commit cf5c22d

Browse files
Nicolas Pitrenashif
authored andcommitted
sflist: SYS_SFLIST_FLAGS_MASK must be a long not an int
When splitting the pointer from the flag, ~SYS_SFLIST_FLAGS_MASK remains a 32-bit value because of the lack of an L qualifier. Let's qualify it with UL so the top half of 64-bit pointers is not truncated. Signed-off-by: Nicolas Pitre <[email protected]>
1 parent 549bd60 commit cf5c22d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/misc/sflist.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static inline void sys_sflist_init(sys_sflist_t *list)
200200
}
201201

202202
#define SYS_SFLIST_STATIC_INIT(ptr_to_list) {NULL, NULL}
203-
#define SYS_SFLIST_FLAGS_MASK 0x3U
203+
#define SYS_SFLIST_FLAGS_MASK 0x3UL
204204

205205
static inline sys_sfnode_t *z_sfnode_next_peek(sys_sfnode_t *node)
206206
{
@@ -281,7 +281,7 @@ static inline u8_t sys_sfnode_flags_get(sys_sfnode_t *node)
281281
*/
282282
static inline void sys_sfnode_init(sys_sfnode_t *node, u8_t flags)
283283
{
284-
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0U, "flags too large");
284+
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0UL, "flags too large");
285285
node->next_and_flags = flags;
286286
}
287287

@@ -297,7 +297,7 @@ static inline void sys_sfnode_init(sys_sfnode_t *node, u8_t flags)
297297
*/
298298
static inline void sys_sfnode_flags_set(sys_sfnode_t *node, u8_t flags)
299299
{
300-
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0U, "flags too large");
300+
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0UL, "flags too large");
301301
node->next_and_flags = (unative_t)(z_sfnode_next_peek(node)) | flags;
302302
}
303303

0 commit comments

Comments
 (0)