set(U)Int64 implementation
See original GitHub issueHi!
Thanks so much for fixing the previous int64 issue so quickly. I believe I ran into another bug trying to actually write these int64 values to the capnp message.
For example, writing capnp.Uint64.fromNumber(Math.pow(500000, 2)) into a Uint64 field and reading it out returns 891896832 (instead of 250000000000 which is still well under the max value).
I investigated this a little bit and it seems like https://github.com/jdiaz5513/capnp-ts/blob/master/packages/capnp-ts/src/serialization/segment.ts#L451 could be the culprit - val.buffer
is actually a Uint8 array of length 8 but only the first half of it seems to be getting set. Replacing this with e.g.
for (var i = 0; i < val.buffer.length; ++i) {
this._dv.setUint8(byteOffset + i, val.buffer[i]);
}
seemed to do the trick and fix the issue I was seeing. https://github.com/jdiaz5513/capnp-ts/blob/master/packages/capnp-ts/src/serialization/segment.ts#L405 seems to have a similar issue although I haven’t personally verified that one yet.
Let me know if you have any questions or other suggestions to work around this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
One of the publish scripts didn’t work as expected, darn. I’ll push up 0.1.6 soon.
On Fri, Nov 3, 2017 at 9:28 AM, Stas Moreinis notifications@github.com wrote:
v0.1.5 pushed, thanks for the help. Hopefully I’ll catch more of these myself as I work on RPC this month.