Ruud H.G. van Tol on Thu, 30 Mar 2023 19:44:32 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: bit_ffs
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Thu, 30 Mar 2023 19:43:16 +0200
- Delivery-date: Thu, 30 Mar 2023 19:44:32 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1680198196; bh=wmt+y4nXNgovJKxeAo6kJeGvV+Dz32gazkK7a2ylm/M=; h=Date:Subject:To:References:From:In-Reply-To:From; b=f4OMH/VA2wzmWWBoccEpDqQLqx0yrL2MT56QO0TJ6RVJ0ca7AjdqoC+aAkQyXZ1KC 9n6+YUl+1p3wOwAVQiAimTGiBhScPt5bNzFUwWXjg1wwYNa+NJ7cPIKwScYlUhwOHR 5HjK1kJsWJE1uG191QroR51bpY+DwBLtBgHEoytIJHt37IGQ7EtyyX7wd1Rnr0d/Ur u6RSJMcfApuHlS7TgPTsPi2tA2CuXFhBSGLlHf3OxeSs+vNqm9t6qpY0lUkIOxFuc4 YkJR4KlencFfZGsvr06NxdurEW1HM/fYkeLkyob1KlGWuJWI7tqwPWloDIGBNT55PT LDPEgAUwByUDQ==
- In-reply-to: <684b63b3-ab0e-bbac-a45f-a3e87421227c@isolution.nl>
- References: <684b63b3-ab0e-bbac-a45f-a3e87421227c@isolution.nl>
On 2023-03-30 19:02, Ruud H.G. van Tol wrote:
Might be interesting to add:
https://en.wikipedia.org/wiki/Find_first_set
https://www.man7.org/linux/man-pages/man3/ffs.3.html
https://www.go4expert.com/articles/builtin-gcc-functions-builtinclz-t29238/
Or are those too low-level?
bit_ffs, bit_ctz
Count trailing set bits:
bit_cts(n) = logint( 1 + bitand(n, bitneg(n) - 1), 2 )
(no idea yet if that is a good implementation)
Would also be nice to have a turbo version of that.
-- Ruud
- Follow-Ups:
- Re: bit_ffs
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- References:
- bit_ffs
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>