SNOBOL4LOGIC(3)

πŸ“¦
version 2.3.1 Β· 3 versions
, in fedora 43, fedora 44, opensuse-leap 16.0

🌸 SNOBOL4LOGIC(3) 🌸

okay bestie, come sit with me, because this page is from the CSNOBOL4 Manual and it's literally the bit-manipulation bestie you didn't know you needed. it's giving logic, but make it slay. πŸ’…


✨ NAME ✨

snobol4logic β€” bitwise logic and conversions for SNOBOL4. yes, we're doing bits today. no cap. πŸ¦‹


✨ SYNOPSYS ✨

(yes, that's how it's spelled up top, we don't fix it, we respect it 🫢)

-INCLUDE 'logic.sno'

✨ DESCRIPTION ✨

so for all the binary operations, here's the vibe check: either argument can be INTEGER or STRING β€” and if both of them are strings, they must be of the same length. that's not a suggestion, that's the law. 😭

okay now the function lineup, main character energy only:

  • NOT(arg) β€” returns bitwise not (complement) of integer argument.
  • AND(arg1,arg2) β€” bitwise intersection.
  • OR(arg1,arg2) β€” bitwise union.
  • XOR(arg1,arg2) β€” bitwise exclusive or (equivalence).
  • NAND(arg1,arg2) β€” bitwise intersection (first argument complemented).
  • NOR(arg1,arg2) β€” bitwise union (first argument complemented).
  • UPLUS(arg1,arg2) β€” unsigned addition.
  • UMINUS(arg1,arg2) β€” unsigned subtraction.
  • UMUL(arg1,arg2) β€” unsigned multiplication.
  • UDIV(arg1,arg2) β€” unsigned division.
  • SHL(arg1,arg2) β€” shift left.
  • SHR(arg1,arg2) β€” shift right.
  • SAR(arg1,arg2) β€” arithmetic (signed) shift right.
  • ROL(arg1,arg2) β€” rotate left.
  • ROR(arg1,arg2) β€” rotate right.
  • HI(str) β€” convert base 16 string to integer.
  • IH(int) β€” convert integer to base16 string.
  • DIB(str,n) β€” convert base n string to integer.
  • IDB(int,n) β€” convert integer to base n string.

like, look at that range. logic ops, unsigned math, shifts, rotates, and base conversion? she does it all. πŸ”₯


✨ COMPATIBILITY ✨

compatible with Catspaw SPITBOL LOGIC function. so if you're coming from there, you already know the assignment. πŸ’œ


✨ SEE ALSO ✨


✨ AUTHOR ✨

Philip L. Budne


and that's the whole page, bestie!! 🌈 this was CSNOBOL4B 2.3.1, dated March 31, 2022 β€” go forth and manipulate those bits, you absolute icon πŸ‘‘πŸ’–

πŸ“¦ where this page comes from