You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just had reason to use bitwise math expressions in a bash script, and realized that it could be useful to have in Fish, as well. Unfortunately, codeplea/tinyexpr#22 (comment) indicates that, absent the use of a fork (BobBurns/tinyexpr), tinyexpr will not support bitwise expressions (the reasoning for this is good).
I’m wondering if there’s a way to add these. For the specific use case I have (conditional command execution), it is possible to use contains, but there are other cases where it might be useful to have bitwise operations.
The text was updated successfully, but these errors were encountered:
So I tested an implementation of this, and it's reasonably simple with the restriction that it just truncates to int, which I don't think would be that awful.
However, I don't think we should use the normal infix operators for this. For one ^ (which would signify xor) is already taken, and & and | just really look like logical operators (but I consider them a mistake in C to begin with).
Yeah I ended up implementing these as bitand, bitor and bitxor. They're simply functions that take two arguments, and they truncate to integer before doing their thing, because bitwise operations on floats don't really make sense.
I just had reason to use bitwise math expressions in a bash script, and realized that it could be useful to have in Fish, as well. Unfortunately, codeplea/tinyexpr#22 (comment) indicates that, absent the use of a fork (BobBurns/tinyexpr),
tinyexpr
will not support bitwise expressions (the reasoning for this is good).I’m wondering if there’s a way to add these. For the specific use case I have (conditional command execution), it is possible to use
contains
, but there are other cases where it might be useful to have bitwise operations.The text was updated successfully, but these errors were encountered: