I am using an int type to store a value. By the semantics of the program, the value always varies in a very small range (0 - 36), and int (not a
There is standard support for this. What you should do is to include stdint.h (cstdint) and then use the type uint_fast8_t.
This tells the compiler that you are only using numbers between 0 - 255, but that it is free to use a larger type if that gives faster code. Similarly, the compiler can assume that the variable will never have a value above 255 and then do optimizations accordingly.