Commit 52505ab5a2f0235d73553b6e8ecaa45943d1efc6

Calvin Buckley 2021-07-07T19:12:02

Convert long long constant specifiers to stdint macros

diff --git a/src/commit_graph.c b/src/commit_graph.c
index b301d3d..70b5b8c 100644
--- a/src/commit_graph.c
+++ b/src/commit_graph.c
@@ -304,7 +304,7 @@ static int git_commit_graph_entry_get_byindex(
 	e->generation = ntohl(*((uint32_t *)(commit_data + GIT_OID_RAWSZ + 2 * sizeof(uint32_t))));
 	e->commit_time = ntohl(*((uint32_t *)(commit_data + GIT_OID_RAWSZ + 3 * sizeof(uint32_t))));
 
-	e->commit_time |= (e->generation & 0x3ull) << 32ull;
+	e->commit_time |= (e->generation & UINT64_C(0x3)) << UINT64_C(32);
 	e->generation >>= 2u;
 	if (e->parent_indices[1] & 0x80000000u) {
 		uint32_t extra_edge_list_pos = e->parent_indices[1] & 0x7fffffff;
diff --git a/src/diff_xdiff.h b/src/diff_xdiff.h
index aca80b1..9b303e9 100644
--- a/src/diff_xdiff.h
+++ b/src/diff_xdiff.h
@@ -16,7 +16,7 @@
 /* xdiff cannot cope with large files.  these files should not be passed to
  * xdiff.  callers should treat these large files as binary.
  */
-#define GIT_XDIFF_MAX_SIZE (1024LL * 1024 * 1023)
+#define GIT_XDIFF_MAX_SIZE (INT64_C(1024) * 1024 * 1023)
 
 /* A git_xdiff_output is a git_patch_generate_output with extra fields
  * necessary to use libxdiff.  Calling git_xdiff_init() will set the diff_cb
diff --git a/src/hashsig.c b/src/hashsig.c
index a5fbeee..43310ca 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -17,7 +17,7 @@ typedef uint64_t hashsig_state;
 #define HASHSIG_SCALE 100
 
 #define HASHSIG_MAX_RUN 80
-#define HASHSIG_HASH_START	0x012345678ABCDEF0LL
+#define HASHSIG_HASH_START	INT64_C(0x012345678ABCDEF0)
 #define HASHSIG_HASH_SHIFT  5
 
 #define HASHSIG_HASH_MIX(S,CH) \
diff --git a/src/mwindow.c b/src/mwindow.c
index 5fcae2e..1ef3562 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -20,7 +20,7 @@
 		: 32 * 1024 * 1024)
 
 #define DEFAULT_MAPPED_LIMIT \
-	((1024 * 1024) * (sizeof(void*) >= 8 ? 8192ULL : 256UL))
+	((1024 * 1024) * (sizeof(void*) >= 8 ? UINT64_C(8192) : 256UL))
 
 /* default is unlimited */
 #define DEFAULT_FILE_LIMIT 0
diff --git a/src/util.h b/src/util.h
index dabd4c9..56a60a4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -22,7 +22,7 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 #define bitsizeof(x) (CHAR_BIT * sizeof(x))
-#define MSB(x, bits) ((x) & (~0ULL << (bitsizeof(x) - (bits))))
+#define MSB(x, bits) ((x) & (~UINT64_C(0) << (bitsizeof(x) - (bits))))
 #ifndef min
 # define min(a,b) ((a) < (b) ? (a) : (b))
 #endif
diff --git a/src/win32/w32_util.h b/src/win32/w32_util.h
index 060504e..1321d30 100644
--- a/src/win32/w32_util.h
+++ b/src/win32/w32_util.h
@@ -75,7 +75,7 @@ GIT_INLINE(void) git_win32__filetime_to_timespec(
 	struct timespec *ts)
 {
 	int64_t winTime = ((int64_t)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
-	winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
+	winTime -= INT64_C(116444736000000000); /* Windows to Unix Epoch conversion */
 	ts->tv_sec = (time_t)(winTime / 10000000);
 #ifdef GIT_USE_NSEC
 	ts->tv_nsec = (winTime % 10000000) * 100;
@@ -87,11 +87,11 @@ GIT_INLINE(void) git_win32__filetime_to_timespec(
 GIT_INLINE(void) git_win32__timeval_to_filetime(
 	FILETIME *ft, const struct p_timeval tv)
 {
-	int64_t ticks = (tv.tv_sec * 10000000LL) +
-		(tv.tv_usec * 10LL) + 116444736000000000LL;
+	int64_t ticks = (tv.tv_sec * INT64_C(10000000)) +
+		(tv.tv_usec * INT64_C(10)) + INT64_C(116444736000000000);
 
-	ft->dwHighDateTime = ((ticks >> 32) & 0xffffffffLL);
-	ft->dwLowDateTime = (ticks & 0xffffffffLL);
+	ft->dwHighDateTime = ((ticks >> 32) & INT64_C(0xffffffff));
+	ft->dwLowDateTime = (ticks & INT64_C(0xffffffff));
 }
 
 GIT_INLINE(void) git_win32__stat_init(