Re: [RFC] include/linux/make_type.h: Helpers for making u16/u32/u64 values

From: Alexey Dobriyan
Date: Wed Feb 14 2024 - 12:24:57 EST


> +#define make_u16(hi__, lo__) ((u16)(u8)(hi__) << 8 | (u8)(lo__))

Public Service Announcement

Identifiers representing macro arguments generally don't need to be
undescored. They are local to the macro, they don't leak outside.

End of Public Service Announcement



Firstly, make_u16() doesn't return u16.

Secondly,

#define make_u64(hi__, lo__) ((u64)(hi__) << 32 | (u32)(lo__))

doesn't truncate hi, why?