hermann on Fri, 04 Jul 2025 16:39:46 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: flags in a bitmap


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 <Bill.Allombert@math.u-bordeaux.fr>
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.