BITFIELDINSERT(3G)

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

πŸ’– BITFIELDINSERT πŸ’–

okay bestie, welcome to the bitfieldInsert(3G) page ✨ this is one of those GLSL bit-manipulation girlies and she is lowkey iconic. it's giving "surgical bit surgery" and honestly? obsessed. 🫢


🌸 NAME 🌸

bitfieldInsert β€” insert a range of bits into an integer πŸŽ€


✨ DECLARATION ✨

here's the whole signature situation, copy it exactly bestie, no improvising πŸ’…

genIType bitfieldInsert(genIType base, genIType insert, int offset,
                        int bits);

genUType bitfieldInsert(genUType base, genUType insert, int offset,
                        int bits);

πŸŽ€ PARAMETERS πŸŽ€

  • base β€” this is the integer you're inserting into. the main character, fr fr. it's the one getting the glow-up.
  • insert β€” this is the value of the bits you're inserting. yes, the original says "the the value" and honestly? she's quirky, we love her. πŸ’€
  • offset β€” the index of the first bit to insert. where the magic starts, periodt.
  • bits β€” how many bits you're inserting. the count, the vibe, the number. ⭐

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: bitfieldInsert takes the bits least significant bits of insert and drops them into base at offset. πŸͺ„

the returned value will have bits [offset, offset + bits + 1] taken from [0, bits - 1] of insert, and all other bits taken directly from the corresponding bits of base. like a little bit-swap makeover. πŸ’…

if bits is zero, the result will simply be the original value of base β€” no notes, she's unchanged, she's thriving. 🌸

⚠️ and now the scary part bestie, listen up: the result will be undefined if offset or bits is negative, or if the sum of offset and bits is greater than the number of bits used to store the operand. undefined behaviour is not the vibe, do not test her. πŸ˜­πŸ’€

🌈 VERSION SUPPORT 🌈

so the original had a whole big table, and we're doing it as a list because tables are not the vibe here. same facts, same energy. ✨

Function name: bitfieldInsert β€” OpenGL Shading Language Version support:

  • 1.10 β€” - (nope, not yet, she wasn't born πŸ’€)
  • 1.20 β€” -
  • 1.30 β€” -
  • 1.40 β€” -
  • 1.50 β€” -
  • 3.30 β€” -
  • 4.00 β€” βœ” (she's HERE πŸ‘‘)
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ”

πŸ’œ SEE ALSO πŸ’œ

  • bitfieldExtract()

her sister, her other half, go read it too, iykyk 🧚


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!! πŸŽ€ this manual came from [FIXME: source], dated 01/03/2018, and she answers to the name BITFIELDINSERT(3G). slay, ate, no crumbs, go insert some bits responsibly πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from