Re: flags in a bitmap

[email protected]
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
On 2025-07-04 15:51, Bill Allombert wrote:
> Great, I have made a GIT branch bill-bitset
> 
> commit 8632eaf7528554234aaa90d9a503476452cbd736 (HEAD -> bill-bitset,
> origin/bill-bitset, master)
> Author: Bill Allombert <[email protected]>
> Date:   Thu Jul 3 23:57:00 2025 +0200
> 
>     New GP functions bitset, bitclear
> 
> Cheers,
> Bill
> 
Thanks, I checked out that branch and build, works.
These are the bit commands, the first two are new:

pi@raspberrypi5:~/pari/pari $ ./gp -q
? ?bitset
bitset(~n,i): set bit i of n in place

? ?bitclear
bitclear(~n,i): clear bit i of n (in place)

? ?bittest
bittest(x,n): gives bit number n (coefficient of 2^n) of the integer x. 
Negative numbers behave as if
modulo big power of 2.

?


The branch name resembles std::bittest
https://en.cppreference.com/w/cpp/utility/bitset.html

gp bitset  matches set
gp bittest matches test

Shouldn't bitclear be named bitreset to match std::bitset?

Maybe add bitflip to match std::bitset<N>::flip ?

Regards,

Hermann.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.