int64

Converting __int64 to long in Windows

只谈情不闲聊 提交于 2019-12-20 02:11:11
问题 How to convert __int64 to long in Windows (MSVC8 & MSVC6)? Will a normal typecasting work? Also, how about converting long to __int64? If the long is a negative value, will it work? Note - I am talking of a scenario in which the __int64 variable will always contain a value which will not be more than 32 bits long. 回答1: 1. Convert long to __int64 Acorrding to MSDN on the __int64 keyword: The _ _int64 keyword declares a new type, a 64-bit (8-byte) integer. As with the int, short, and long types

_int64 does not name a type

前提是你 提交于 2019-12-18 13:24:46
问题 In my pch file I have the following definitions: #if (_MSC_VER < 1300) typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #else typedef signed __int8 int8_t; typedef signed __int16 int16_t; typedef signed __int32 int32_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; #endif typedef signed __int64 int64_t;

Which initializer is appropriate for an int64_t?

走远了吗. 提交于 2019-12-17 19:18:44
问题 I like to initialize my variables to some "dummy" value and have started to use int64_t and uint64_t . So far, it looks like there are at least three ways I could initialize an int64_t to a particular value (and with slight changes for the unsigned equivalent): int64_t method_one = 0; int64_t method_two = 0LL; int64_t method_three = INT64_C(0); I use GCC and target OS X and Linux. I'd like to pick a method that aims for ease of portability and clarity — but correctness, above all. Am I

Generate random values in C#

帅比萌擦擦* 提交于 2019-12-17 09:22:16
问题 How can I generate random Int64 and UInt64 values using the Random class in C#? 回答1: 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.

How to use Int64 in C#

旧时模样 提交于 2019-12-12 09:36:21
问题 The question is easy! How do you represent a 64 bit int in C#? 回答1: 64 bit int is long 回答2: System.Int64 is the .net type, in C# it's also called long 回答3: A signed 64 bit integer is long , an unsigned is ulong . The corresponding types in the framwwork are System.Int64 and System.UInt64 , respectively. Example: long bigNumber = 9223372036854775807; 回答4: By using the long data type, or ulong for unsigned. Table of Integral C# Types 来源: https://stackoverflow.com/questions/3845205/how-to-use

Swift Cannot construct string with argument type Int64

江枫思渺然 提交于 2019-12-11 14:05:58
问题 I am making a game that involves a Game Center leaderboard. I want to make a custom leaderboard UI rather than using the default interface. I am trying to convert the values stored in a Game Center leaderboard into a string so that I may display them using an SKLabelNode. However, I get an error saying that: Cannot invoke initializer for type 'String' with an argument list of type '(Int64?)' I am accessing the Game Center scores using leaderboard.scores[i].value When I use the String

C++: how to check, that enum has only unique values

丶灬走出姿态 提交于 2019-12-10 21:41:48
问题 we use VS 2008 there is a big enum, which is populated by many developers this enum has a type __int64 (a Microsoft extension), and I want to make compiler complain about non unique values in enum. if it was a usual enum I would do like this: enum E1 { E11 = 0x01F00, E12 = 0x01F00, E13 }; #pragma warning(push) #pragma warning(error: 4061) #pragma warning(error: 4062) void F(E1 e1) { switch (e1) { case E11: case E12: case E13: return; } } #pragma warning(pop) and the function F would have an

php5 converts 64 bit integer to double - how force 64-bit?

不羁的心 提交于 2019-12-10 17:48:00
问题 in php5, pass a 64bit integer, 1707541557936130 through GET, but it shows value of 1.7075415579361E+15 how can I force php to use large integers as integers, not as float when I shift << apparently the result of that is int32 as well, not int64 is there a way to globally say use int64? 回答1: PHP supports 64bit integers only on 64bit systems. In both cases integers, that are larger than PHP_INT_MAX, are converted to floats. see manual. Try this code: <?php $i=1707541557936130; var_dump($i);

How to write INT64 to CString

眉间皱痕 提交于 2019-12-10 15:33:51
问题 I am coding in c++ windows. INT64 dirID = -1; CString querySQLStr = _T(""); querySQLStr.Format(L"select * from ImageInfo where FolderPath=%64d;", dirID); querySQLStr always like this: select * from ImageInfo where FolderPath= 1214; is it right to use %64d? Many Thanks 回答1: I don't have a windows machine handy to test this on, but I think CString should accept this: querySQLStr.Format("%I64d", dirID); It's probably worth noting that this is windows specific, but since you're using CString I

Is it ok to use 64bit integers in a 32bit application?

删除回忆录丶 提交于 2019-12-10 03:28:36
问题 I notice in C and C++, we can use int64_t , or simply a long long . If I compile 32bit code using these types, will I suffer any performance issues on 64bit and/or 32bit machines ? Aside from saving some RAM, would I ever have a reason to just use int ? After all, 64bit ints are far more useful in storing large numbers. 回答1: If I compile 32bit code using these types, will I suffer any performance issues on 64bit and/or 32bit machines? Your compiler may need to generate several machine code