Content-Length: 287466 | pFad | http://github.com/postgrespro/postgres_cluster/commit/07cbcdd00c2465a844513f14b7a96232013d3129
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e710f3b commit 07cbcddCopy full SHA for 07cbcdd
src/backend/lib/hyperloglog.c
@@ -49,6 +49,7 @@
49
#include <math.h>
50
51
#include "lib/hyperloglog.h"
52
+#include "port/pg_bitutils.h"
53
54
#define POW_2_32 (4294967296.0)
55
#define NEG_POW_2_32 (-4294967296.0)
@@ -242,11 +243,13 @@ rho(uint32 x, uint8 b)
242
243
{
244
uint8 j = 1;
245
- while (j <= b && !(x & 0x80000000))
246
- {
247
- j++;
248
- x <<= 1;
249
- }
+ if (x == 0)
+ return b + 1;
+
+ j = 32 - pg_leftmost_one_pos32(x);
250
251
+ if (j > b)
252
253
254
return j;
255
}
Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/07cbcdd00c2465a844513f14b7a96232013d3129
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy
0 commit comments