int64

what is the performance impact of using int64_t instead of int32_t on 32-bit systems?

荒凉一梦 提交于 2019-11-28 04:18:16
Our C++ library currently uses time_t for storing time values. I'm beginning to need sub-second precision in some places, so a larger data type will be necessary there anyway. Also, it might be useful to get around the Year-2038 problem in some places. So I'm thinking about completely switching to a single Time class with an underlying int64_t value, to replace the time_t value in all places. Now I'm wondering about the performance impact of such a change when running this code on a 32-bit operating system or 32-bit CPU. IIUC the compiler will generate code to perform 64-bit arithmetic using

Do I need to have 64 bit Processor to use 64 bit data type

一笑奈何 提交于 2019-11-27 22:50:37
I have a few questions: Do I need to have 64 bit Processor to use 64 bit data type(__int64 or int64_t) ? What means by, the "t" of int64_t? Starting from what version of GCC and VCC are supporting data type? Is the 64 bit data type are just doubling the data length or there are some other things going under the hood too? You don't need 64 bit processor to use 64 bit data type. It all depends on the compiler and only on the compiler. The compiler can provide you with 128-bit, 237-bit or 803-bit data types, if it so desires. However, keep in mind that normally 32-bit CPUs cannot handle 64-bit

Swift - Cast Int64 to AnyObject for NSMutableArray

核能气质少年 提交于 2019-11-27 19:25:22
问题 Hi I have a NSMutableArray and I try this: var ma = NSMutableArray() let number:Int64 = 8345834344 ma.addObject(number)// Error "Type Int64 does not conform to protocol AnyObject" How to add Int64 variable to NSMutableArray() ? 回答1: You are using a Foundation array (NSMutableArray), so you should use a Foundation number object: ma.addObject(NSNumber(longLong:number)) You could also use a native swift array: var ma = [Int64]() ma.append(number) 回答2: Like so much of Swift, this is implemented

node.js is there any proper way to parse JSON with large numbers? (long, bigint, int64)

ⅰ亾dé卋堺 提交于 2019-11-27 14:39:59
When I parse this little piece of JSON { "value" : 9223372036854775807 } that's what I get { hello: 9223372036854776000 } Is there any way to parse it properly? Not with built-in JSON.parse. You'll need to parse it manually and treat values as string (if you want to do arithmetics with them there is bignumber.js ) You can use Douglas Crockford JSON.js library as a base for your parser. EDIT: I created a package for you :) var JSONbig = require('json-bigint'); var json = '{ "value" : 9223372036854775807, "v2": 123 }'; console.log('Input:', json); console.log(''); console.log('node.js bult-in

How to input int64_t / uint64_t constants?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 07:44:34
问题 What I'm trying to do is to define a constant equal to 2^30 (I may change it to something like 2^34, so I prefer to have a room larger than 32 bits for it). Why the following minimal(?) example doesn't compile? #include <stdint.h> // test.cpp:4:33: error: expected primary-expression before numeric constant // test.cpp:4:33: error: expected ')' before numeric constant const uint64_t test = (uint64_t 1) << 30; //const uint64_t test1 = (uint64_t(1)) << 30;// this one magically compiles! why? int

Generate random values in C#

有些话、适合烂在心里 提交于 2019-11-27 07:25:49
How can I generate random Int64 and UInt64 values using the Random class in C#? Noldorin This should do the trick. (It's an extension method so that you can call it just as you call the normal Next or NextDouble methods on a Random object). public static Int64 NextInt64(this Random rnd) { var buffer = new byte[sizeof(Int64)]; rnd.NextBytes(buffer); return BitConverter.ToInt64(buffer, 0); } Just replace Int64 with UInt64 everywhere if you want unsigned integers instead and all should work fine. Note: Since no context was provided regarding security or the desired randomness of the generated

Isn't an Int64 equal to a long in C#?

两盒软妹~` 提交于 2019-11-27 06:35:03
问题 I have been playing around with SQL and databases in C# via SqlCeConnection. I have been using ExecuteReader to read results and BigInt values for record IDs which are read into Longs. Today I have been playing with SQL statements that use COUNT based statements ('SELECT COUNT(*) FROM X') and have been using ExecuteScalar to read these single valued results. However, I ran into an issue. I can't seem to store the values into a Long data type, which I have been using up to now. I can store

what is the performance impact of using int64_t instead of int32_t on 32-bit systems?

*爱你&永不变心* 提交于 2019-11-27 05:18:50
问题 Our C++ library currently uses time_t for storing time values. I'm beginning to need sub-second precision in some places, so a larger data type will be necessary there anyway. Also, it might be useful to get around the Year-2038 problem in some places. So I'm thinking about completely switching to a single Time class with an underlying int64_t value, to replace the time_t value in all places. Now I'm wondering about the performance impact of such a change when running this code on a 32-bit

Do I need to have 64 bit Processor to use 64 bit data type

早过忘川 提交于 2019-11-26 21:09:48
问题 I have a few questions: Do I need to have 64 bit Processor to use 64 bit data type(__int64 or int64_t) ? What means by, the "t" of int64_t? Starting from what version of GCC and VCC are supporting data type? Is the 64 bit data type are just doubling the data length or there are some other things going under the hood too? 回答1: You don't need 64 bit processor to use 64 bit data type. It all depends on the compiler and only on the compiler. The compiler can provide you with 128-bit, 237-bit or

node.js is there any proper way to parse JSON with large numbers? (long, bigint, int64)

别等时光非礼了梦想. 提交于 2019-11-26 16:49:47
问题 When I parse this little piece of JSON { "value" : 9223372036854775807 } that's what I get { hello: 9223372036854776000 } Is there any way to parse it properly? 回答1: Not with built-in JSON.parse. You'll need to parse it manually and treat values as string (if you want to do arithmetics with them there is bignumber.js) You can use Douglas Crockford JSON.js library as a base for your parser. EDIT: I created a package for you :) var JSONbig = require('json-bigint'); var json = '{ "value" :