diff mbox series

FreeBSD: Properly typedef __{u,s}{8,16,32,64}

Message ID 751D724C-0535-4C3E-A0FF-17C9E356166E@siemens.com
State Accepted
Headers show
Series FreeBSD: Properly typedef __{u,s}{8,16,32,64} | expand

Commit Message

Storm, Christian June 3, 2024, 6:26 p.m. UTC
While Linux does define these, the BSDs don't. So do
properly typedef __{u,s}{8,16,32,64} to BSD-known types.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 include/compat.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Stefano Babic June 4, 2024, 1:34 p.m. UTC | #1
On 03.06.24 20:26, 'Storm, Christian' via swupdate wrote:
> While Linux does define these, the BSDs don't. So do
> properly typedef __{u,s}{8,16,32,64} to BSD-known types.
>
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>   include/compat.h | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/include/compat.h b/include/compat.h
> index 764176d2..3915219f 100644
> --- a/include/compat.h
> +++ b/include/compat.h
> @@ -45,5 +45,13 @@
>   /*
>    * The BSDs don't define this while Linux does.
>    */
> -#define __u64 uint64_t
> +#include <sys/types.h>
> +typedef int8_t   __s8;
> +typedef uint8_t  __u8;
> +typedef int16_t  __s16;
> +typedef uint16_t __u16;
> +typedef int32_t  __s32;
> +typedef uint32_t __u32;
> +typedef int64_t  __s64;
> +typedef uint64_t __u64;
>   #endif

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/include/compat.h b/include/compat.h
index 764176d2..3915219f 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -45,5 +45,13 @@ 
 /*
  * The BSDs don't define this while Linux does.
  */
-#define __u64 uint64_t
+#include <sys/types.h>
+typedef int8_t   __s8;
+typedef uint8_t  __u8;
+typedef int16_t  __s16;
+typedef uint16_t __u16;
+typedef int32_t  __s32;
+typedef uint32_t __u32;
+typedef int64_t  __s64;
+typedef uint64_t __u64;
 #endif