diff --git a/src/libsysprof-capture/sysprof-capture-types.h b/src/libsysprof-capture/sysprof-capture-types.h index 854ff838..ae7f7ff8 100644 --- a/src/libsysprof-capture/sysprof-capture-types.h +++ b/src/libsysprof-capture/sysprof-capture-types.h @@ -82,9 +82,9 @@ SYSPROF_BEGIN_DECLS #define SYSPROF_CAPTURE_ADDRESS_FORMAT "0x%016" G_GINT64_MODIFIER "x" #if GLIB_SIZEOF_VOID_P == 8 -# define SYSPROF_CAPTURE_JITMAP_MARK G_GUINT64_CONSTANT(0xE000000000000000) +# define SYSPROF_CAPTURE_JITMAP_MARK SYSPROF_UINT64_CONSTANT(0xE000000000000000) #elif GLIB_SIZEOF_VOID_P == 4 -# define SYSPROF_CAPTURE_JITMAP_MARK G_GUINT64_CONSTANT(0xE0000000) +# define SYSPROF_CAPTURE_JITMAP_MARK SYSPROF_UINT64_CONSTANT(0xE0000000) #else #error Unknown GLIB_SIZEOF_VOID_P #endif diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 953328e8..88c5697a 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -76,9 +76,10 @@ #include "sysprof-capture-util-private.h" #include "sysprof-capture-writer.h" #include "sysprof-macros-internal.h" +#include "sysprof-macros.h" #define DEFAULT_BUFFER_SIZE (_sysprof_getpagesize() * 64L) -#define INVALID_ADDRESS (G_GUINT64_CONSTANT(0)) +#define INVALID_ADDRESS (SYSPROF_UINT64_CONSTANT(0)) #define MAX_COUNTERS ((1 << 24) - 1) #define MAX_UNWIND_DEPTH 64 diff --git a/src/libsysprof-capture/sysprof-clock.h b/src/libsysprof-capture/sysprof-clock.h index 523b5968..288a1fc0 100644 --- a/src/libsysprof-capture/sysprof-clock.h +++ b/src/libsysprof-capture/sysprof-clock.h @@ -69,7 +69,7 @@ typedef int SysprofClock; typedef int64_t SysprofTimeStamp; typedef int32_t SysprofTimeSysprofan; -#define SYSPROF_NSEC_PER_SEC G_GINT64_CONSTANT(1000000000) +#define SYSPROF_NSEC_PER_SEC SYSPROF_INT64_CONSTANT(1000000000) SYSPROF_AVAILABLE_IN_ALL SysprofClock sysprof_clock; diff --git a/src/libsysprof-capture/sysprof-macros.h b/src/libsysprof-capture/sysprof-macros.h index 1faa0022..be2afc1c 100644 --- a/src/libsysprof-capture/sysprof-macros.h +++ b/src/libsysprof-capture/sysprof-macros.h @@ -59,6 +59,16 @@ #pragma once +#include + +#if INT_MAX == LONG_MAX +#define SYSPROF_INT64_CONSTANT(x) x##ULL +#define SYSPROF_UINT64_CONSTANT(x) x##LL +#else +#define SYSPROF_INT64_CONSTANT(x) x##UL +#define SYSPROF_UINT64_CONSTANT(x) x##L +#endif + #ifdef __cplusplus #define SYSPROF_BEGIN_DECLS extern "C" { #define SYSPROF_END_DECLS }