On 8/5/2020 8:37 AM, Đoàn Trần Công Danh wrote: > On 2020-07-30 15:02:32-0400, Derrick Stolee <stolee@xxxxxxxxx> wrote: >> On 7/30/2020 12:57 PM, Derrick Stolee wrote: >>> On 7/29/2020 6:23 PM, Emily Shaffer wrote: >>>> On Thu, Jul 23, 2020 at 05:56:33PM +0000, Derrick Stolee via GitGitGadget wrote: >>>>> diff --git a/builtin/gc.c b/builtin/gc.c >>>>> index eb4b01c104..889d97afe7 100644 >>>>> --- a/builtin/gc.c >>>>> +++ b/builtin/gc.c >>>>> @@ -1021,19 +1021,65 @@ static int multi_pack_index_expire(void) >>>>> return result; >>>>> } >>>>> >>>>> +#define TWO_GIGABYTES (2147483647) >>>> >>>> [jonathan tan] This would be easier to understand if it was expressed >>>> with bitshift, e.g. 1 << 31 >>> >>> This is actually ((1 << 31) - 1) because "unsigned long" is 32-bits >>> on Windows. But it's better to not use magic numbers and instead use >>> operations like this. >> >> Nevermind. This breaks the build on 32-bit machines (even adding a few >> "L" characters). I'll replace my magic decimal number with a magic >> hexadecimal number. > > Would it be better if we use this C99 feature instead: > > #define TWO_GIGABYTES INT32_MAX > > But it seems like it's available everywhere, except (maybe) Windows. > (judging from UINT32_MAX's usage) Thanks for the recommendation. This appears to work in all of the CI builds, including Windows. I'll use that constant in my next version. Perhaps we will discover a platform that doesn't have it by including it. -Stolee