From 4d57a8df99bc20ed6155c8cbd307c7c5245093b0 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 17 Sep 2024 01:44:51 +0200 Subject: [PATCH] stdc_count_ones: Fix compilation error with g++ < 4.4. * lib/stdbit.in.h (__gl_stdbit_popcount_wide): Suffix 64-bit integer constant with LL. --- ChangeLog | 6 ++++++ lib/stdbit.in.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index be79b9228e..3551ae92de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-09-16 Bruno Haible + + stdc_count_ones: Fix compilation error with g++ < 4.4. + * lib/stdbit.in.h (__gl_stdbit_popcount_wide): Suffix 64-bit integer + constant with LL. + 2024-09-16 Bruno Haible faccessat: Correct errno value on AIX. diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h index 9f9e60a5d3..20b9f4f466 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -308,7 +308,7 @@ __gl_stdbit_popcount_wide (unsigned long long int n) x333333 = max / (1 << 2 | 1), /* 0x333333... */ x0f0f0f = max / (1 << 4 | 1), /* 0x0f0f0f... */ x010101 = max / ((1 << 8) - 1), /* 0x010101... */ - x000_7f = max / 0xffffffffffffffff * 0x7f; /* 0x000000000000007f... */ + x000_7f = max / 0xffffffffffffffffLL * 0x7f; /* 0x000000000000007f... */ n -= (n >> 1) & x555555; n = (n & x333333) + ((n >> 2) & x333333); n = (n + (n >> 4)) & x0f0f0f; -- 2.39.5