Here it is important that the canonical code chosen keeps codes of same length together. Then look up in the second table the decoded symbol and the length. I personally prefer that one if the memory is not tight. You might also choose the table based on the amount of 0's preceding the next 1. But stop search for a 1 after a fixed length.
Modern processors have an assembler instruction for that search.
In a real implementation you could, for example, avoid the subtraction by adjusting the table pointers. The other tables contain a symbol and a codelength. There are ways to omit the codelengths, see below. If a symbol has a shorter codelength than the symbol with the longest codelength in that table it occupies more than one place - just like with the full decoding table in the first attempt. Again optimizations are possible.