Commit 6a7f04030e124855c3e617a21c814074a2585753

Edward Thomson 2021-07-16T08:47:37

Merge pull request #5941 from NattyNarwhal/stdintification stdintification: use int64_t and INT64_C instead of long long

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
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/hash/sha1/generic.h b/src/hash/sha1/generic.h
index e4cc602..53fc082 100644
--- a/src/hash/sha1/generic.h
+++ b/src/hash/sha1/generic.h
@@ -11,7 +11,7 @@
 #include "hash/sha1.h"
 
 struct git_hash_sha1_ctx {
-	unsigned long long size;
+	uint64_t size;
 	unsigned int H[5];
 	unsigned int W[16];
 };
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/integer.h b/src/integer.h
index a3a0f53..6327717 100644
--- a/src/integer.h
+++ b/src/integer.h
@@ -43,10 +43,10 @@ GIT_INLINE(int) git__is_ulong(int64_t p)
 }
 
 /** @return true if p fits into the range of an int */
-GIT_INLINE(int) git__is_int(long long p)
+GIT_INLINE(int) git__is_int(int64_t p)
 {
 	int r = (int)p;
-	return p == (long long)r;
+	return p == (int64_t)r;
 }
 
 /* Use clang/gcc compiler intrinsics whenever possible */
diff --git a/src/khash.h b/src/khash.h
index 40e2d18..7adccdb 100644
--- a/src/khash.h
+++ b/src/khash.h
@@ -131,17 +131,8 @@ int main() {
 
 /* compiler specific configuration */
 
-#if UINT_MAX == 0xffffffffu
-typedef unsigned int khint32_t;
-#elif ULONG_MAX == 0xffffffffu
-typedef unsigned long khint32_t;
-#endif
-
-#if ULONG_MAX == ULLONG_MAX
-typedef unsigned long khint64_t;
-#else
-typedef unsigned long long khint64_t;
-#endif
+typedef uint32_t khint32_t;
+typedef uint64_t khint64_t;
 
 #ifndef kh_inline
 #ifdef _MSC_VER
diff --git a/src/mwindow.c b/src/mwindow.c
index 5fcae2e..da2dae2 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) : UINT64_C(256)))
 
 /* default is unlimited */
 #define DEFAULT_FILE_LIMIT 0
diff --git a/src/util.h b/src/util.h
index 1c6677b..a773536 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 d7f9d3d..1321d30 100644
--- a/src/win32/w32_util.h
+++ b/src/win32/w32_util.h
@@ -74,8 +74,8 @@ GIT_INLINE(void) git_win32__filetime_to_timespec(
 	const FILETIME *ft,
 	struct timespec *ts)
 {
-	long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
-	winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
+	int64_t winTime = ((int64_t)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
+	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)
 {
-	long long 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(
diff --git a/tests/core/encoding.c b/tests/core/encoding.c
index a677afe..6cec246 100644
--- a/tests/core/encoding.c
+++ b/tests/core/encoding.c
@@ -14,7 +14,7 @@ void test_core_encoding__decode(void)
 	cl_assert(size == 4);
 
 	buf = (unsigned char *)"\xaa\xaa\xfe\xdc\xbaXY";
-	cl_assert(git_decode_varint(buf, &size) == 1489279344088ULL);
+	cl_assert(git_decode_varint(buf, &size) == UINT64_C(1489279344088));
 	cl_assert(size == 6);
 
 	buf = (unsigned char *)"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xfe\xdc\xbaXY";
@@ -35,8 +35,8 @@ void test_core_encoding__encode(void)
 	cl_assert(git_encode_varint(buf, 100, 267869656) == 4);
 	cl_assert(!memcmp(buf, "\xfe\xdc\xbaX", 4));
 
-	cl_assert(git_encode_varint(buf, 100, 1489279344088ULL) == 6);
+	cl_assert(git_encode_varint(buf, 100, UINT64_C(1489279344088)) == 6);
 	cl_assert(!memcmp(buf, "\xaa\xaa\xfe\xdc\xbaX", 6));
 
-	cl_assert(git_encode_varint(buf, 1, 1489279344088ULL) == -1);
+	cl_assert(git_encode_varint(buf, 1, UINT64_C(1489279344088)) == -1);
 }
diff --git a/tests/core/integer.c b/tests/core/integer.c
index bd19651..18364ba 100644
--- a/tests/core/integer.c
+++ b/tests/core/integer.c
@@ -4,168 +4,168 @@ void test_core_integer__multiply_int64_no_overflow(void)
 {
 #if !defined(git__multiply_int64_overflow)
 	int64_t result = 0;
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x1ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x1ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x2ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x2ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x800000000000000ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x800000000000000ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, 0x7fffffffffffffffll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x7fffffffffffffffll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x0ll, -0x8000000000000000ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x1ll));
-	cl_assert_equal_i(result, 0x1ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, -0x1ll));
-	cl_assert_equal_i(result, -0x1ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x2ll));
-	cl_assert_equal_i(result, 0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, -0x2ll));
-	cl_assert_equal_i(result, -0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, -0x7ffffffffffffffll));
-	cl_assert_equal_i(result, -0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x800000000000000ll));
-	cl_assert_equal_i(result, 0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, -0x800000000000000ll));
-	cl_assert_equal_i(result, -0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, 0x7fffffffffffffffll));
-	cl_assert_equal_i(result, 0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x1ll, -0x7fffffffffffffffll));
-	cl_assert_equal_i(result, -0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x1ll));
-	cl_assert_equal_i(result, -0x1ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x1ll));
-	cl_assert_equal_i(result, 0x1ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x2ll));
-	cl_assert_equal_i(result, -0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x2ll));
-	cl_assert_equal_i(result, 0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x7ffffffffffffffll));
-	cl_assert_equal_i(result, -0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x800000000000000ll));
-	cl_assert_equal_i(result, -0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x800000000000000ll));
-	cl_assert_equal_i(result, 0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, 0x7fffffffffffffffll));
-	cl_assert_equal_i(result, -0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x7fffffffffffffffll));
-	cl_assert_equal_i(result, 0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, 0x1ll));
-	cl_assert_equal_i(result, 0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, -0x1ll));
-	cl_assert_equal_i(result, -0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, 0x2ll));
-	cl_assert_equal_i(result, 0x4ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, -0x2ll));
-	cl_assert_equal_i(result, -0x4ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, 0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, -0x7ffffffffffffffll));
-	cl_assert_equal_i(result, -0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, 0x800000000000000ll));
-	cl_assert_equal_i(result, 0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, -0x800000000000000ll));
-	cl_assert_equal_i(result, -0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, 0x1ll));
-	cl_assert_equal_i(result, -0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, -0x1ll));
-	cl_assert_equal_i(result, 0x2ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, 0x2ll));
-	cl_assert_equal_i(result, -0x4ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, -0x2ll));
-	cl_assert_equal_i(result, 0x4ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, 0x7ffffffffffffffll));
-	cl_assert_equal_i(result, -0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, -0x7ffffffffffffffll));
-	cl_assert_equal_i(result, 0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, 0x800000000000000ll));
-	cl_assert_equal_i(result, -0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x2ll, -0x800000000000000ll));
-	cl_assert_equal_i(result, 0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x2ll, -0x4000000000000000ll));
-	cl_assert_equal_i(result, -0x8000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x1ll));
-	cl_assert_equal_i(result, 0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x1ll));
-	cl_assert_equal_i(result, -0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x2ll));
-	cl_assert_equal_i(result, 0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x2ll));
-	cl_assert_equal_i(result, -0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x1ll));
-	cl_assert_equal_i(result, -0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x1ll));
-	cl_assert_equal_i(result, 0x7ffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x2ll));
-	cl_assert_equal_i(result, -0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x2ll));
-	cl_assert_equal_i(result, 0xffffffffffffffell);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x1ll));
-	cl_assert_equal_i(result, 0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x1ll));
-	cl_assert_equal_i(result, -0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x2ll));
-	cl_assert_equal_i(result, 0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x2ll));
-	cl_assert_equal_i(result, -0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x1ll));
-	cl_assert_equal_i(result, -0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x1ll));
-	cl_assert_equal_i(result, 0x800000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x2ll));
-	cl_assert_equal_i(result, -0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x2ll));
-	cl_assert_equal_i(result, 0x1000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x1ll));
-	cl_assert_equal_i(result, 0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x1ll));
-	cl_assert_equal_i(result, -0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x4000000000000000ll, 0x2ll));
-	cl_assert_equal_i(result, -0x8000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x1ll));
-	cl_assert_equal_i(result, -0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x1ll));
-	cl_assert_equal_i(result, 0x7fffffffffffffffll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x0ll));
-	cl_assert_equal_i(result, 0x0ll);
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(-0x8000000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x1));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x1));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x1));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x1));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x7fffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(0x4));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x4));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x2));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x4));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(0x4));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(-0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x7ffffffffffffff)));
+	cl_assert_equal_i(result, INT64_C(0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x800000000000000)));
+	cl_assert_equal_i(result, INT64_C(0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x4000000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x8000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(-0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x7ffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(-0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(0xffffffffffffffe));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x800000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x2)));
+	cl_assert_equal_i(result, INT64_C(0x1000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x4000000000000000), INT64_C(0x2)));
+	cl_assert_equal_i(result, INT64_C(-0x8000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(0x7fffffffffffffff));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x0)));
+	cl_assert_equal_i(result, INT64_C(0x0));
 #endif
 }
 
@@ -173,69 +173,69 @@ void test_core_integer__multiply_int64_overflow(void)
 {
 #if !defined(git__multiply_int64_overflow)
 	int64_t result = 0;
-	cl_assert(git__multiply_int64_overflow(&result, 0x2ll, 0x4000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x2ll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x2ll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x2ll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x2ll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x2ll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x2ll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7ffffffffffffffll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7ffffffffffffffll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x800000000000000ll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x800000000000000ll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x4000000000000000ll, 0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, 0x7fffffffffffffffll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x7fffffffffffffffll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x2ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x7ffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x800000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x7fffffffffffffffll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x8000000000000000ll));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x4000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x2), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x2), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7ffffffffffffff), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7ffffffffffffff), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x800000000000000), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x800000000000000), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x4000000000000000), INT64_C(0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x7fffffffffffffff), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x7fffffffffffffff), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x2)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x7ffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x800000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x7fffffffffffffff)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x8000000000000000)));
 #endif
 }
 
@@ -243,11 +243,11 @@ void test_core_integer__multiply_int64_edge_cases(void)
 {
 #if !defined(git__multiply_int64_overflow)
 	int64_t result = 0;
-	cl_assert(!git__multiply_int64_overflow(&result, -0x8000000000000000ll, -0x1ll));
-	cl_assert_equal_i(result, -0x8000000000000000ll);
-	cl_assert(!git__multiply_int64_overflow(&result, -0x1ll, -0x8000000000000000ll));
-	cl_assert_equal_i(result, -0x8000000000000000ll);
-	cl_assert(git__multiply_int64_overflow(&result, 0x1ll, -0x8000000000000000ll));
-	cl_assert(git__multiply_int64_overflow(&result, -0x8000000000000000ll, 0x1ll));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(-0x1)));
+	cl_assert_equal_i(result, INT64_C(-0x8000000000000000));
+	cl_assert(!git__multiply_int64_overflow(&result, INT64_C(-0x1), INT64_C(-0x8000000000000000)));
+	cl_assert_equal_i(result, INT64_C(-0x8000000000000000));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(0x1), INT64_C(-0x8000000000000000)));
+	cl_assert(git__multiply_int64_overflow(&result, INT64_C(-0x8000000000000000), INT64_C(0x1)));
 #endif
 }
diff --git a/tests/core/strtol.c b/tests/core/strtol.c
index cac6ca5..851b91b 100644
--- a/tests/core/strtol.c
+++ b/tests/core/strtol.c
@@ -32,7 +32,7 @@ void test_core_strtol__int32(void)
 	assert_l32_parses("  +123 ", 123, 10);
 	assert_l32_parses("  -123 ", -123, 10);
 	assert_l32_parses("  +2147483647 ", 2147483647, 10);
-	assert_l32_parses("  -2147483648 ", -2147483648LL, 10);
+	assert_l32_parses("  -2147483648 ", INT64_C(-2147483648), 10);
 	assert_l32_parses("A", 10, 16);
 	assert_l32_parses("1x1", 1, 10);
 
@@ -49,9 +49,9 @@ void test_core_strtol__int64(void)
 	assert_l64_parses("  +123 ", 123, 10);
 	assert_l64_parses("  -123 ", -123, 10);
 	assert_l64_parses("  +2147483647 ", 2147483647, 10);
-	assert_l64_parses("  -2147483648 ", -2147483648LL, 10);
-	assert_l64_parses("  2147483657 ", 2147483657LL, 10);
-	assert_l64_parses("  -2147483657 ", -2147483657LL, 10);
+	assert_l64_parses("  -2147483648 ", INT64_C(-2147483648), 10);
+	assert_l64_parses("  2147483657 ", INT64_C(2147483657), 10);
+	assert_l64_parses("  -2147483657 ", INT64_C(-2147483657), 10);
 	assert_l64_parses(" 9223372036854775807  ", INT64_MAX, 10);
 	assert_l64_parses("   -9223372036854775808  ", INT64_MIN, 10);
 	assert_l64_parses("   0x7fffffffffffffff  ", INT64_MAX, 16);
diff --git a/tests/graph/commit_graph.c b/tests/graph/commit_graph.c
index 4c7c5a7..75a6c52 100644
--- a/tests/graph/commit_graph.c
+++ b/tests/graph/commit_graph.c
@@ -23,14 +23,14 @@ void test_graph_commit_graph__parse(void)
 	cl_git_pass(git_oid_fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47"));
 	cl_assert_equal_oid(&e.tree_oid, &id);
 	cl_assert_equal_i(e.generation, 1);
-	cl_assert_equal_i(e.commit_time, 1273610423ull);
+	cl_assert_equal_i(e.commit_time, UINT64_C(1273610423));
 	cl_assert_equal_i(e.parent_count, 0);
 
 	cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
 	cl_git_pass(git_commit_graph_entry_find(&e, cgraph, &id, GIT_OID_HEXSZ));
 	cl_assert_equal_oid(&e.sha1, &id);
 	cl_assert_equal_i(e.generation, 5);
-	cl_assert_equal_i(e.commit_time, 1274813907ull);
+	cl_assert_equal_i(e.commit_time, UINT64_C(1274813907));
 	cl_assert_equal_i(e.parent_count, 2);
 
 	cl_git_pass(git_oid_fromstr(&id, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
@@ -66,7 +66,7 @@ void test_graph_commit_graph__parse_octopus_merge(void)
 	cl_git_pass(git_oid_fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c"));
 	cl_assert_equal_oid(&e.tree_oid, &id);
 	cl_assert_equal_i(e.generation, 7);
-	cl_assert_equal_i(e.commit_time, 1447083009ull);
+	cl_assert_equal_i(e.commit_time, UINT64_C(1447083009));
 	cl_assert_equal_i(e.parent_count, 3);
 
 	cl_git_pass(git_oid_fromstr(&id, "ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6"));
diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c
index ee70ec6..2c8d885 100644
--- a/tests/revwalk/basic.c
+++ b/tests/revwalk/basic.c
@@ -530,7 +530,7 @@ void test_revwalk_basic__big_timestamp(void)
 	cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJECT_COMMIT));
 
 	/* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */
-	cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", 2399662595ll, 0));
+	cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", INT64_C(2399662595), 0));
 	cl_git_pass(git_commit_tree(&tree, tip));
 
 	cl_git_pass(git_commit_create(&id, _repo, "HEAD", sig, sig, NULL, "some message", tree, 1,