BITFIELDREVERSE(3G)

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

πŸ’… BITFIELDREVERSE πŸ’…

okay bestie, so this is a page from the 3G manual β€” that's the OpenGL-adjacent section, the one where all the GLSL girlies live. and today's main character is bitfieldReverse, a function that literally just... flips your bits. backwards. iconic behaviour, honestly.


✨ NAME ✨

bitfieldReverse β€” reverse the order of bits in an integer πŸ¦‹


πŸŽ€ DECLARATION πŸŽ€

so here's the vibe, two overloads, both valid, both serving:

genIType bitfieldReverse(genIType value);

genUType bitfieldReverse(genUType value);

🌸 PARAMETERS 🌸

  • value β€” the value whose bits you want reversed. that's it. that's the whole input. hand it over and let her cook πŸ’–

πŸ‘‘ DESCRIPTION πŸ‘‘

bitfieldReverse returns the reversal of the bits of value. like, the whole bit order, flipped end to end.

the bit numbered n will be taken from bit (bits - 1) - n of value, where bits is the total number of bits used to represent value.

so yeah. bit 0 becomes the top bit, the top bit becomes bit 0, and everybody in between swaps sides. it's giving mirror. it's giving glow-up in reverse. ✨


🫢 VERSION SUPPORT 🫢

not every GLSL era was ready for her, ngl. here's the tea, OpenGL Shading Language Version by version:

  • 1.10 β€” - nope πŸ™ˆ
  • 1.20 β€” - nope
  • 1.30 β€” - nope
  • 1.40 β€” - nope
  • 1.50 β€” - nope
  • 3.30 β€” - nope
  • 4.00 β€” βœ” YES bestie πŸ’–
  • 4.10 β€” βœ” yes
  • 4.20 β€” βœ” yes
  • 4.30 β€” βœ” yes
  • 4.40 β€” βœ” yes
  • 4.50 β€” βœ” yes, still slaying πŸ‘‘
so like, if you're kicking it in 1.10 through 3.30, bitfieldReverse simply does not exist for you. 4.00 is when she made her debut. no cap. πŸŽ€

πŸ”₯ SEE ALSO πŸ”₯

  • bitfieldExtract()
  • bitfieldInsert()
  • bitCount()

the whole bit-manipulation friend group, fr fr. go say hi. πŸ¦‹


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!! πŸŽ€βœ¨ source situation is [FIXME: source] (yes girl, we know, the FIXME is still sitting there, she's doing her best 😭) and the date on this masterpiece is 01/03/2018 β€” so it's a lil vintage but still ate. πŸ’… BITFIELDREVERSE(3G), signing off. mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from