2 ms·
Looking at ASCII decimal values, a-z correspond to 97-122 so if you want to use a 32 bit bitmap you remap 97-122 to 0-25 by subtracting 97 ('a'). If you can us
by mytailorisrich 4y ago
Looking at ASCII decimal values, a-z correspond to 97-122 so if you want to use a 32 bit bitmap you remap 97-122 to 0-25 by subtracting 97 ('a').
If you can use a 128 bit bitmap for the same cost then you could indeed directly index by ASCII values.
You can also get rid of the 'if' on window size in the main loop by partially unrolling it and taking those cases (start and end of string) outside.