Ruud H.G. van Tol on Wed, 05 Jul 2023 21:27:40 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: How to do t_INT bit operations? |
On 2023-07-05 21:15, Karim Belabas wrote:
* hermann@stamm-wilbrandt.de [2023-07-05 20:52]:I found bit shift operators in users.pdf:[...]Is that the way to do t_INT bit operations in GP? Are there alternatives more like the C bit operators?? bit<TAB> bitand bitnegimply bitprecision bitxor bitneg bitor bittest You may want to check those functions (except bitprecision) The reference cards are also a good place to look for functions (here in refcard.pdf, first page, section on "Operators")
Also see: binary(), valuation(), logint(). Examples: 1. count trailing 0-bits: valuation(n,2). 2. count trailing 1-bits: valuation(n+1,2). -- Ruud