Skip to content

Commit

Permalink
Add optional PG_FORCEINLINE macro for people to test out as an altern…
Browse files Browse the repository at this point in the history
…ative to PG_INLINE
  • Loading branch information
MyreMylar committed May 19, 2020
1 parent 58b089b commit 9ea2420
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src_c/include/pgplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
#endif
#endif /* ~PG_INLINE */

// Worth trying this on MSVC/win32 builds to see if provides any speed up
#ifndef PG_FORCEINLINE
#if defined(__clang__)
#define PG_INLINE __inline__ __attribute__((__unused__))
#elif defined(__GNUC__)
#define PG_INLINE __inline__
#elif defined(_MSC_VER)
#define PG_INLINE __forceinline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define PG_INLINE inline
#else
#define PG_INLINE
#endif
#endif /* ~PG_INLINE */

/* This is unconditionally defined in Python.h */
#if defined(_POSIX_C_SOURCE)
#undef _POSIX_C_SOURCE
Expand Down

0 comments on commit 9ea2420

Please sign in to comment.