src/cx/common.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
--- a/src/cx/common.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/common.h	Thu Oct 16 19:57:47 2025 +0200
@@ -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
@@ -351,6 +358,4 @@
 cx_attr_export int cx_szmul_impl(size_t a, size_t b, size_t *result);
 #endif // cx_szmul
 
-
-
 #endif // UCX_COMMON_H

mercurial