Fix type errors

I was having problems building go-capnproto on the latest go rc (1.2rc1) installed from homebrew (`brew install --devel go`). I fixed up the type errors I saw, but I'm very new to go, so there may have been a better way to do this. Below are the errors I get when trying to install without these changes:
```
# github.com/jmckaskill/go-capnproto
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:122: invalid operation: i < segnum (mismatched types int and uint32)
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:123: cannot use i (type int) as type uint32 in function argument
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:124: cannot use len(seg.Data) / 8 (type int) as type uint32 in function argument
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:128: cannot use n (type int) as type int64 in return argument
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:132: invalid operation: i < segnum (mismatched types int and uint32)
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:133: cannot use i (type int) as type uint32 in function argument
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:135: cannot use written + n (type int) as type int64 in return argument
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:137: undefined: n
../../../.go/src/github.com/jmckaskill/go-capnproto/mem.go:140: cannot use written (type int) as type int64 in return argument
```