Silence GCC -Wcast-qual warning

Use C++ casts instead of C-style casts in order to silence warning about casting away qualifiers.

warning: cast from type 'volatile bool*' to type 'bool*' casts away qualifiers [-Wcast-qual]
Merge pull request #2 from K-ballo/patch-2

Silence GCC -Wcast-qual warning