ucx/cx/common.h

branch
dav-2
changeset 889
42cdbf9bbd49
parent 886
da79af4baec8
--- a/ucx/cx/common.h	Tue Oct 14 21:02:26 2025 +0200
+++ b/ucx/cx/common.h	Sat Nov 08 23:06:11 2025 +0100
@@ -49,7 +49,7 @@
  * <a href="https://uap-core.de/hg/ucx">https://uap-core.de/hg/ucx</a>
  * </p>
  *
- * <h2>LICENCE</h2>
+ * <h2>LICENSE</h2>
  *
  * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved.
  *
@@ -189,7 +189,7 @@
  */
 #define cx_attr_cstr_arg(idx)
 /**
- * No support for access attribute in clang.
+ * No support for the access attribute in clang.
  */
 #define cx_attr_access(mode, ...)
 #else
@@ -265,15 +265,32 @@
 #define _Thread_local __declspec(thread)
 #endif // _MSC_VER
 
+// ---------------------------------------------------------------------------
+//       Exported and inlined functions
+// ---------------------------------------------------------------------------
+
 #if defined(CX_WINDLL_EXPORT)
-#define cx_attr_export __declspec(dllexport)
+#define CX_EXPORT __declspec(dllexport)
 #elif defined(CX_WINDLL)
-#define cx_attr_export __declspec(dllimport)
+#define CX_EXPORT __declspec(dllimport)
 #else
 /** Only used for building Windows DLLs. */
-#define cx_attr_export
+#define CX_EXPORT
 #endif // CX_WINDLL / CX_WINDLL_EXPORT
 
+#ifdef __GNUC__
+/**
+ * Declares a function to be inlined.
+ */
+#define CX_INLINE __attribute__((always_inline)) static inline
+#else
+#define CX_INLINE static inline
+#endif
+/**
+ * Declares a compatibility function for C++ builds.
+ */
+#define CX_CPPDECL static inline
+
 // ---------------------------------------------------------------------------
 //       Useful function pointers
 // ---------------------------------------------------------------------------
@@ -281,22 +298,12 @@
 /**
  * Function pointer compatible with fwrite-like functions.
  */
-typedef size_t (*cx_write_func)(
-        const void *,
-        size_t,
-        size_t,
-        void *
-);
+typedef size_t (*cx_write_func)(const void*, size_t, size_t, void*);
 
 /**
  * Function pointer compatible with fread-like functions.
  */
-typedef size_t (*cx_read_func)(
-        void *,
-        size_t,
-        size_t,
-        void *
-);
+typedef size_t (*cx_read_func)(void*, size_t, size_t, void*);
 
 // ---------------------------------------------------------------------------
 //       Utility macros
@@ -348,9 +355,7 @@
 #if __cplusplus
 extern "C"
 #endif
-cx_attr_export int cx_szmul_impl(size_t a, size_t b, size_t *result);
+CX_EXPORT int cx_szmul_impl(size_t a, size_t b, size_t *result);
 #endif // cx_szmul
 
-
-
 #endif // UCX_COMMON_H

mercurial