vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
542 stars 90 forks source link

Support for bitmasks #352

Closed avidseeker closed 1 year ago

avidseeker commented 1 year ago

Bitmasks are helpful in representing a vector of binary choices.

I was wondering if it's possible to implement binary operators: << >> & | !

johncbowman commented 1 year ago

Asymptote defines the bitwise functions int AND(int,int), int OR(int,int), int XOR(int,int), int NOT(int), int CLZ(int) (count leading zeros), int CTZ(int) (count trailing zeros), int popcount(int) (count bits populated by ones), and int bitreverse(int a, int bits) (reverse bits within a word of length bits).