Int64/UInt64

127 views
Skip to first unread message

Brennan Kinney

unread,
Mar 26, 2015, 8:59:48 AM3/26/15
to haxe...@googlegroups.com
I'm trying to use either haxe.Int64 or UInt64 with cpp/cs, but the values being assigned are raising errors? I'm not sure if I'm meant to import UInt64 for cpp, but with cs I'm using cs.StdTypes;
For example:  var n:Int64 = 0x9e3779b97f4a7c13; will error with 'Invalid hexadecimal integer', with large integers instead of hex I get this error: 'Float should be haxe.Int64'

I haven't had much luck with google, the api only provides raw api calls, there is no example code showing usage. I'm assuming they're all the used in the same way?

Alexander Kuzmenko

unread,
Mar 26, 2015, 4:43:20 PM3/26/15
to haxe...@googlegroups.com
Try varn:Int64 = Int64.make(highPart, lowPart);

четверг, 26 марта 2015 г., 15:59:48 UTC+3 пользователь Brennan Kinney написал:

Brennan Kinney

unread,
Mar 26, 2015, 6:26:19 PM3/26/15
to haxe...@googlegroups.com
So I need to split my Int64 into high/low? How would I go about that?

Sam MacPherson

unread,
Mar 26, 2015, 7:14:51 PM3/26/15
to haxe...@googlegroups.com
high = 0x9e3779b9 low = 0x7f4a7c13

Brennan Kinney

unread,
Mar 26, 2015, 8:18:06 PM3/26/15
to haxe...@googlegroups.com
Is that only possibly to do manually or via string? What about in this scenario?
a += (k.get(i+0)+(k.get(i+1)<<8)+(k.get(i+2)<<16)+(k.get(i+3)<<24)+(k.get(i+4)<<32)+(k.get(i+5)<<40)+(k.get(i+6)<<48)+(k.get(i+7)<<56));
Where a is Int64/UInt64 and k is Bytes, even though I typed a to haxe.Int64 I will get this error: 'Cannot add haxe.Int64 and Int', so I would need to store the value which could be Int or possibly Int64 and then split it into high/low? Trying to port Bob Jenkins lookup8.c hash algorithm. I need this specific one for a tool that expects hashes from this algorithm. http://burtleburtle.net/bob/c/lookup8.c

Alexander Kuzmenko

unread,
Mar 27, 2015, 6:39:33 AM3/27/15
to haxe...@googlegroups.com
I think this example should work fine in Haxe 3.2 (if not, i guess, you should open an issue). Int64 moved to abstract and now has operators overloading: https://github.com/HaxeFoundation/haxe/blob/development/std/haxe/Int64.hx

пятница, 27 марта 2015 г., 3:18:06 UTC+3 пользователь Brennan Kinney написал:
Reply all
Reply to author
Forward
0 new messages