stdint constants in test suite Passes w/ gcc 11 on Fedora x64. Protip: So you don;t have to suffer, ``` perl -pe 's/(-?(?:0x)?[A-Fa-f0-9]+)([Uu])?[Ll][Ll]/\U$2INT64_C(\E$1)/mg' ```
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
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..ce0894f 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, INT64_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,