[sysprof: 34/63] libsysprof-capture: Use SYSPROF_INT64_CONSTANT instead of GLib version
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof: 34/63] libsysprof-capture: Use SYSPROF_INT64_CONSTANT instead of GLib version
- Date: Sat, 4 Jul 2020 18:32:12 +0000 (UTC)
commit 14078e6c4d506ab9f9ec27500af196e537ec325d
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jul 2 11:21:01 2020 +0100
libsysprof-capture: Use SYSPROF_INT64_CONSTANT instead of GLib version
Same for the unsigned version. They do the same thing as the GLib
versions.
Signed-off-by: Philip Withnall <withnall endlessm com>
Helps: #40
src/libsysprof-capture/sysprof-capture-types.h | 4 ++--
src/libsysprof-capture/sysprof-capture-writer.c | 3 ++-
src/libsysprof-capture/sysprof-clock.h | 2 +-
src/libsysprof-capture/sysprof-macros.h | 10 ++++++++++
4 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/libsysprof-capture/sysprof-capture-types.h b/src/libsysprof-capture/sysprof-capture-types.h
index 854ff83..ae7f7ff 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 953328e..88c5697 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 523b596..288a1fc 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 1faa002..be2afc1 100644
--- a/src/libsysprof-capture/sysprof-macros.h
+++ b/src/libsysprof-capture/sysprof-macros.h
@@ -59,6 +59,16 @@
#pragma once
+#include <limits.h>
+
+#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 }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]