DAY 040: _TOGGLEBIT
#11
_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
Reply
#12
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
b = b + ...
Reply
#13
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
Reply
#14
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
Reply
#15
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
Reply
#16
(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
Reply
#17
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.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply




Users browsing this thread: 1 Guest(s)