News for hackers. Stuff that matters.
Re:EABitTricks.h by efortis on Monday December 19, 2022 @08:51PM (#34060539)
Another handy one: Bitwise Table Lookup

  /* Bits: selected, hovered */
  const colors = [
    grey,  // 00
    green, // 01
    blueA, // 10
    blueB  // 11
  ]
  const color = colors[selected << 1 | hovered]
https://blog.uidrafter.com/bitwise-table-lookup

There are no comments on this comment yet.