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

Function npyv_divc_u64

numpy/core/src/common/simd/sse/arithmetic.h:222–232  ·  view source on GitHub ↗

divide each unsigned 64-bit element by a precomputed divisor

Source from the content-addressed store, hash-verified

220}
221// divide each unsigned 64-bit element by a precomputed divisor
222NPY_FINLINE npyv_u64 npyv_divc_u64(npyv_u64 a, const npyv_u64x3 divisor)
223{
224 // high part of unsigned multiplication
225 __m128i mulhi = npyv__mullhi_u64(a, divisor.val[0]);
226 // floor(a/d) = (mulhi + ((a-mulhi) >> sh1)) >> sh2
227 __m128i q = _mm_sub_epi64(a, mulhi);
228 q = _mm_srl_epi64(q, divisor.val[1]);
229 q = _mm_add_epi64(mulhi, q);
230 q = _mm_srl_epi64(q, divisor.val[2]);
231 return q;
232}
233// divide each signed 64-bit element by a precomputed divisor (round towards zero)
234NPY_FINLINE npyv_s64 npyv_divc_s64(npyv_s64 a, const npyv_s64x3 divisor)
235{

Callers

nothing calls this directly

Calls 1

npyv__mullhi_u64Function · 0.70

Tested by

no test coverage detected