Questions tagged [unsigned-long-long-int]

unsigned long long int specified in the C99 standard

unsigned long long long int is at least 64-bit in size and was specified in the C99 standard. It is the same as long long but unsigned.

151 questions
5
votes
3 answers

64bit integer conversion from string

I'm dealing with the problem of reading a 64bit unsigned integer unsigned long long from a string. My code should work both for GCC 4.3 and Visual Studio 2010. I read this question and answers on the topic: Read 64 bit integer string from file and…
Antonio Pérez
  • 6,078
  • 4
  • 27
  • 54
5
votes
1 answer

Double to `unsigned long long` causes memory (stack?) corruption

What is wrong with the following code (crashes): #include #include void foo(std::string str, unsigned long long val) { std::cout<< str<< " "<< val<< std::endl; // Crashes if commented as well } int main() { double d =…
Xyand
  • 4,290
  • 3
  • 33
  • 59
4
votes
2 answers

Assigning length of a string to an integer: C++

Using C++, I want to create a for loop as follows (text is a std::string): for(int i = text.size(); i >= 0; i--) { { Please could somebody help me understand why my complier (Xcode) requires me to initialise i as an unsigned long, and not as…
4
votes
2 answers

How to convert a hex string to an unsigned long?

I have following hex value CString str; str = T("FFF000"); How to convert this in to an unsigned long?
Chris_vr
  • 6,210
  • 15
  • 59
  • 119
4
votes
1 answer

How to determine the maximum value for which a program can calculate factorial using unsigned long long?

How to write a proper algorithm in C that determines the maximum value for which the program can calculate factorial using unsigned long long int? My example does not work properly. Using Linux/64bit and GCC, it gives me 65 iterations. #include…
Eifel
  • 53
  • 7
4
votes
3 answers

Parsing 64-bit unsigned integer on iOS

I have very big unsigned integral number in NSString. This may be big to 2^64. Is there an existing functions/classes parsing this? As I know, it's unsigned long long value, but, It's hard to know what kind of method should I use to parse this.
eonil
  • 75,400
  • 74
  • 294
  • 482
4
votes
2 answers

Check if unsigned long long is available

How can i check by a preprocessor directive if the type unsigned long long is available in the current build environment? I tried checking #if __STDC_VERSION__ >= 199901L /* Available */ #else /* Not available */ #endif but compiling with…
urzeit
  • 2,635
  • 15
  • 34
4
votes
3 answers

unsigned int(32bit) to unsigned long long (64bit)

In the code below, I multiplied 0xffffffff by 2 for an unsigned int(32bit) and stored it in a unsigned long long(64bit). Why don't I get the actual output which is 8589934588. Instead I get 4294967294. Thanks in advance. OUTPUT: Sizeof…
3
votes
1 answer

How to work on intergers as large as 2^9000000 in C++

The largest data type for positive integers I know of is unsigned long long. Is there a way to work on integers as large as 2^9000000 in C++. I use gcc compiler in code-blocks but can also work on visual studio.
Usama Tahir
  • 121
  • 6
3
votes
1 answer

unsigned long long VS unsigned long long int

I want to know the main difference with unsigned long long and unsigned long long int. Can they be used inter-changeably. For calculations involving huge decimal numbers like 9223372036854775807, which one is preferred? Thanks.
Safwan Ull Karim
  • 552
  • 3
  • 9
  • 18
3
votes
1 answer

Compiler macro to test difference between uint64_t and unsigned long long int

I have C++11 code that is failing to compile because an overloaded function is redefined with the same types as arguments: char const* foo(uint64_t) { return "%" PRIu64; } char const* foo(unsigned long long int) { return "%llu"; } Is there a…
Alex Reynolds
  • 91,635
  • 50
  • 223
  • 320
3
votes
1 answer

Unsigned long long overflow error?

I have been having some strange issues with unsigned long long. It happens when I set an unsigned long long (I used size_t, however the problem is repeatable with u-l-l). I have set it to 2^31, however for some reason it reverts to…
2
votes
3 answers

How can I seekg() files over 4GB on Windows?

I am on Windows 7, 64bit and NTFS. I am building a DLL that must be 32 bit. I have a very simple routine that I'd like to implement in C++. I'm reading a large file using: unsigned long p; ifstream source(file); streampos…
Josep Valls
  • 5,102
  • 2
  • 30
  • 59
2
votes
2 answers

why is overload with unsigned __int64 and __int64 ambiguous

Using VS2008, why is this OK (not allowed to use 2010). void assert(int exp, int actual) {if (exp!=actual) printf("assert failed\n");} void assert(unsigned int exp, unsigned int actual) {if (exp!=actual) printf("assert failed\n");} But this is…
Jim
  • 135
  • 1
  • 9
2
votes
0 answers

How to translate Python infinitely big integer into Cython?

I want to factorize very huge numbers (e.g. 100-bits, 200-bits numbers) with Cython. Hi everyone, I implemented the Elliptic Curve Method for factorization into Python 3.6. Now, I want to speed up my code using Cython (version 29.13). I'm a beginner…
G.F
  • 85
  • 9
1
2
3
10 11