substr: fix casting during compilation

Fix uwescience/myria-web#221