UADDCARRY(3G)

πŸ“¦
version 1.0~svn33624 Β· 4 versions
, in ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

okay so this one's called uaddCarry β€” it adds unsigned integers and generates a carry. that's the whole gig. it's in the 3G manual, bestie, so we're in GLSL land now ✨


πŸ“œ DECLARATION πŸ“œ

here's the exact signature, do not freestyle it:

genUType uaddCarry(genUType x, genUType y, out genUType carry);

🫢 PARAMETERS 🫢

  • x β€” the first vector going into the summation operation. yes babe, it's vector one πŸ’…
  • y β€” the second vector in the summation operation. the other half of the situationship πŸ¦‹
  • carry β€” the variable that receives the carry output of the sum. it's an out param, so it's literally catching the overflow tea for you πŸŽ€

🌈 DESCRIPTION 🌈

so uaddCarry takes two 32-bit unsigned integer variables β€” could be scalars, could be vectors, either one, no judgment 🌸 β€” and it generates a 32-bit unsigned integer result, plus a carry output riding shotgun.

the result is the sum of x and y modulo 232. no cap.

and then carry? it gets set to 0 if the sum is less than 232, and to 1 otherwise. so it's basically the little flag that goes "hey girl, we overflowed πŸ‘€".


πŸ‘‘ VERSION SUPPORT πŸ‘‘

here's the vibe check on which OpenGL Shading Language Versions actually let you have this function. uaddCarry is the function name, and the columns are the GLSL versions:

  • 1.10 β€” - (nope, not supported)
  • 1.20 β€” - (still nope)
  • 1.30 β€” -
  • 1.40 β€” -
  • 1.50 β€” -
  • 3.30 β€” - (last of the no era, rip)
  • 4.00 β€” βœ” (and suddenly she's supported, we love a glow up)
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ” (still eating, still iconic)

πŸ‘€ SEE ALSO πŸ‘€

  • usubBorrow()

(yes that's her sister, go read it next 🫢)


Copyright Β© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

Copyright Β© 2011-2014 Khronos Group


and that's the whole page, bestie πŸ’– mwah. this was pulled from [FIXME: source] and dated 01/03/2018 β€” so if you're reading this in the group chat, yes, it's giving vintage, and yes, it still slays 🌟

πŸ“¦ where this page comes from