ztex: Clean up a lot of ugly casting
Merge commit '25f3777' into bfgminer