Does your code work? When it does, maybe it is not that bad, gcc optimizer is smart.
Have you tested this:
var
i: uint32
s: seq[byte]
p: int
i = cast[uint32](s[p..p+3])
(I have the feeling that the +3 does not really matter for a cast.)
