Add support for recent pin and compilers

This commit contains the changes necessary to make the sampler compatible with recent pin. It also contains a fix needed to build under recent gcc that don't allow implicit cast to smaller integral types