question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

set(U)Int64 implementation

See original GitHub issue

Hi!

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:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jdiaz5513commented, Nov 3, 2017

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:

Ping - any suggestions? Still seeing this from a fresh npm install capnp-ts.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jdiaz5513/capnp-ts/issues/73#issuecomment-341755917, or mute the thread https://github.com/notifications/unsubscribe-auth/ACn_Zzm6RAMIA9z3GDD_IMCUVy9zTBovks5syz88gaJpZM4QO7mi .

1reaction
jdiaz5513commented, Nov 2, 2017

v0.1.5 pushed, thanks for the help. Hopefully I’ll catch more of these myself as I work on RPC this month.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to implement 64-bit integers using a 32-bit ...
int64_t is a 64b integer type and is available if you include stdint.h . uint64_t is the unsigned version and is defined in...
Read more >
Int64 Struct (System) - Microsoft Learn
You can declare an Int64 variable and assign it a literal integer value that is within the range of the Int64 data type....
Read more >
UInt64 | Apple Developer Documentation
Calculates the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the...
Read more >
int64 : 64 bits integer vectors
The int64 package adds 64 bit integer vectors to R. The package provides the int64 and uint64 classes for signed and unsigned integer...
Read more >
11.13. Handling 64-bit Integers - Wireshark
Therefore, in order to count higher than 2^53 in integers, we need a true integer type. The way this is done is with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found