()
| 60 | } |
| 61 | |
| 62 | func (state *loadState) readString() (s string, err error) { |
| 63 | // Feel my pain |
| 64 | maxUint := ^uint(0) |
| 65 | var size uintptr |
| 66 | var size64 uint64 |
| 67 | var size32 uint32 |
| 68 | if uint64(maxUint) == math.MaxUint64 { |
| 69 | err = state.read(&size64) |
| 70 | size = uintptr(size64) |
| 71 | } else if maxUint == math.MaxUint32 { |
| 72 | err = state.read(&size32) |
| 73 | size = uintptr(size32) |
| 74 | } else { |
| 75 | panic(fmt.Sprintf("unsupported pointer size (%d)", maxUint)) |
| 76 | } |
| 77 | if err != nil || size == 0 { |
| 78 | return |
| 79 | } |
| 80 | ba := make([]byte, size) |
| 81 | if err = state.read(ba); err == nil { |
| 82 | s = string(ba[:len(ba)-1]) |
| 83 | } |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | func (state *loadState) readCode() (code []instruction, err error) { |
| 88 | n, err := state.readInt() |
no test coverage detected