cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Join 32 bit int to 64 bit int

Kanitkorn129
4-Participant

Join 32 bit int to 64 bit int

Hi all, 

I try to create services for joining 2, 32 bit int as a high_byte and low_byte.

Like join() function in picture below.

Kanitkorn129_0-1593670955270.png

But seem like in services can't left shift 32 index.

I try to use (3 << 32) the result is always 3 not 12,884,901,888.

But when I use (3<<2) the result is 12.

What is I miss or it have another way to join 2 32 int into 1 

 

2 REPLIES 2

This is Rhino Javascript engine, and I don't think it can handle 64bits Unsigned Ints. You have two options, you can build a Java extension which handles your Unsigned Ints through ThingWorx Long base types (still you will have problems, becouse Thingworx LONG base type it's a 64bits Signed Int: https://www.ptc.com/en/support/article/CS247959 ), or you can use a Javascript Library which handles 64bits Unsigned Int like this one: http://theori.io/pwnjs/integer.js.html or many others which should be outthere.

 

Regads.

Hi Carles
Thank you for your suggestion, I will try the second option.

 

Regards.

Announcements


Top Tags