Content-Length: 288208 | pFad | http://github.com/postgrespro/postgres/commit/fd734f387d8780d9989d750942d026167de8cf3c
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 f1af75c commit fd734f3Copy full SHA for fd734f3
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/commit/fd734f387d8780d9989d750942d026167de8cf3c
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy
0 commit comments