AS3 with INT64

751 views
Skip to first unread message

hsl4125

unread,
Oct 6, 2011, 8:56:47 AM10/6/11
to Protocol Buffers
ActionScript 3.0 has no int64 type.
How can use int64 in ActionScript 3.0??
thanks.

Hochhaus, Andrew

unread,
Oct 6, 2011, 3:14:30 PM10/6/11
to hsl4125, Protocol Buffers
On Thu, Oct 6, 2011 at 7:56 AM, hsl4125 <qlhua...@gmail.com> wrote:
> ActionScript 3.0 has no int64 type.
> How can use int64 in ActionScript 3.0??

I'm not sure about ActionScript, but I have worked with 64-bit values
in JavaScript protocol buffers so some of the following may be helpful
to you.

To the best of my knowledge, JS only has a single data type for
numbers (Number). The Number datatype in JS is a floating point value
that cannot represent the full range of 64-bit values without losing
precision.
http://stackoverflow.com/questions/5353388/javascript-parsing-int64

Therefore, the closure-library javascript version of protocol buffers
provides two different encodings for int64s (both String and Number).
http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/proto2/test.pb.js#2644

The String version of these encodings can be combined with a JS "big
int" class to be able to operate on large values.
http://silentmatt.com/biginteger/
http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/math/long.js

-Andy

杨博

unread,
Jun 18, 2015, 11:10:39 PM6/18/15
to prot...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages