cast is equivalent to reinterpret_cast in C++, it just reinterprets the raw bit pattern (except for numerical types were it does zero-extension or truncation like C casts)
Openarray are "ptr+len", I did misread your parameters and thought it was seq[byte] when I wrote that part of my answer.
