Initially `return static_cast<unsigned long>(1) << v;`. There should be no need to cast v.  However your `return 1ul << v;` should be functionally identical and looks a lot less verbose and thus prefered imo.