Minor nitpick: Instead of having a sentinel, you could use `i = 0; i < sizeof(lut) / sizeof(lut[0]); ++i` (as long as it stays locally-defined like now).