QB64 Phoenix Edition
DAY 040: _TOGGLEBIT - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: Official Links (https://staging.qb64phoenix.com/forumdisplay.php?fid=16)
+--- Forum: Learning Resources and Archives (https://staging.qb64phoenix.com/forumdisplay.php?fid=13)
+---- Forum: Keyword of the Day! (https://staging.qb64phoenix.com/forumdisplay.php?fid=49)
+---- Thread: DAY 040: _TOGGLEBIT (/showthread.php?tid=1310)

Pages: 1 2


RE: DAY 040: _TOGGLEBIT - SMcNeill - 12-19-2022

_TOGGLEBIT is a lot like NOT.  If you're not a person who uses TRUE/FALSE a lot, and you don't have a ton of NOT toggles in your code, then you'll probably never need or use _TOGGLEBIT.  Honestly, I don't think I've ever made use of it either -- I'm much more of a _SETBIT type of person when I need to be, rather than a _TOGGLEBIT guy.  

And honestly, I'm much more of an Old Skool Fool who just sticks to AND NOT, or OR with my code.  It's just what I got used to years before anyone ever thought of a _SETBIT function, and it's just part of my natural coding style and habits; engrained into the very fiber of who I *is* as a programmer.  

You'll see stuff in my code like:  foo = foo OR 1,   ucase = lcase AND NOT 32, and so on, but it's really really rare that you'll ever find any of the _READ, _SET, or _TOGGLE bit commands in stuff I wrote.  Wink


RE: DAY 040: _TOGGLEBIT - bplus - 12-19-2022

When ever I see bits (and Binary) I think of pizza orders.

1 mushrooms yes / no or +1 or not
2 onions yes / no        or +2 or not
3 peppers yes / no      or +4 or not 
4 pepperoni yes / n     or  +8 or not...
5 ham yes / no
6 pineapple yes / no
7 sausage yes / no
8 anchovies no / hell no!

A pizza order in a byte also has unique decimal value


RE: DAY 040: _TOGGLEBIT - Pete - 12-19-2022

Eeeeeeks! It's the EOW (End of World)... We agree on something! Quick, gather up the kids, move away from the sea shore, take refuge in the most densely walled area of the home! Oh, and cancel my subscription to Babes of FB. Honestly, Vince in a thong, on the cover of the last issue was, to say the least, a 'bit' disappointing.

Pete Big Grin


RE: DAY 040: _TOGGLEBIT - Jack - 12-19-2022

Hi Pete
About my decfloat routines they use base 10, more precisely a power of 10 or 1000000000
I did start a binary version in C but haven't done any more coding in it
My internet is down so I am posting this from my phone


RE: DAY 040: _TOGGLEBIT - Pete - 12-20-2022

Thanks, Jack. Hope your internet gets up and running, soon. Bad weather or Cox internet... I don't know which is worse. In that regard, I give cox Category 5 out of 5. I mean it really blooooooooooooows!

[Image: when-i-was-a-kid-there-was-no-internet-s...609580.png]

Pete


RE: DAY 040: _TOGGLEBIT - vince - 12-20-2022

(12-19-2022, 10:42 PM)SMcNeill Wrote: And honestly, I'm much more of an Old Skool Fool who just sticks to AND NOT, or OR with my code.  It's just what I got used to years before anyone ever thought of a _SETBIT function, and it's just part of my natural coding style and habits; engrained into the very fiber of who I *is* as a programmer.  

You'll see stuff in my code like:  foo = foo OR 1,   ucase = lcase AND NOT 32, and so on, but it's really really rare that you'll ever find any of the _READ, _SET, or _TOGGLE bit commands in stuff I wrote.  Wink

Steve the purist


RE: DAY 040: _TOGGLEBIT - OldMoses - 12-20-2022

I've used the bit commands and the logical operators somewhat interchangeably. Using AND, OR & NOT is somewhat quicker for typing, but I feel like the bit commands are better for "comment in code" readability.

I will sometimes set constants equal to bit positions in order to reference bit flipping textually.