MCPcopy Create free account
hub / github.com/numpy/numpy / _pcg_mult64

Function _pcg_mult64

numpy/random/src/pcg64/pcg64.h:131–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131static inline void _pcg_mult64(uint64_t x, uint64_t y, uint64_t *z1,
132 uint64_t *z0) {
133
134#if defined _WIN32 && _M_AMD64
135 z0[0] = _umul128(x, y, z1);
136#else
137 uint64_t x0, x1, y0, y1;
138 uint64_t w0, w1, w2, t;
139 /* Lower 64 bits are straightforward clock-arithmetic. */
140 *z0 = x * y;
141
142 x0 = x & 0xFFFFFFFFULL;
143 x1 = x >> 32;
144 y0 = y & 0xFFFFFFFFULL;
145 y1 = y >> 32;
146 w0 = x0 * y0;
147 t = x1 * y0 + (w0 >> 32);
148 w1 = t & 0xFFFFFFFFULL;
149 w2 = t >> 32;
150 w1 += x0 * y1;
151 *z1 = x1 * y1 + w2 + (w1 >> 32);
152#endif
153}
154
155static inline pcg128_t pcg128_mult(pcg128_t a, pcg128_t b) {
156 uint64_t h1;

Callers 2

pcg128_multFunction · 0.85
pcg128_mult_64Function · 0.85

Calls 1

_umul128Function · 0.85

Tested by

no test coverage detected