Questions tagged [uint64]

The uint64 is a datatype that represents an unsigned integer and is coded on 64 bits in memory.

uint64 is a datatype that represents an and is coded on 64 bits in memory. Unlike its counterpart which is , uint64 can only be used to store positive integers, of values between 0 and 264 - 1.

192 questions
97
votes
2 answers

difference between stdint.h and inttypes.h

What is the difference between stdint.h and inttypes.h? If none of them is used, uint64_t is not recognized but with either of them it is a defined type.
mahmood
  • 23,197
  • 49
  • 147
  • 242
45
votes
5 answers

Unexpected uint64 behaviour 0xFFFF'FFFF'FFFF'FFFF - 1 = 0?

Consider the following brief numpy session showcasing uint64 data type import numpy as np a = np.zeros(1,np.uint64) a # array([0], dtype=uint64) a[0] -= 1 a # array([18446744073709551615], dtype=uint64) # this is 0xffff ffff ffff ffff, as…
Albert.Lang
  • 523
  • 3
  • 8
32
votes
1 answer

Macro representing maximum value for uint64_t

I'm seeking for a macro representing the maximum value of uint64_t as UINT_MAX is for unsigned int. i.e. I need this value to guaranteed to be (1<<64)-1. I tried to use UINT64_MAX, but compiling with g++ results in: 'UINT64_MAX' was not declared in…
Subway
  • 5,286
  • 11
  • 48
  • 59
29
votes
6 answers

C++ convert string to uint64_t

I am trying to convert from a string to a uint64_t integer. stoi returns a 32 bit integer, so it won't work in my case. Are there other solutions?
Cauchy
  • 1,677
  • 2
  • 21
  • 30
25
votes
5 answers

Curious arithmetic error- 255x256x256x256=18446744073692774400

I encountered a strange thing when I was programming under c++. It's about a simple multiplication. Code: unsigned __int64 a1 = 255*256*256*256; unsigned __int64 a2= 255 << 24; // same as the above cerr()<<"a1 is:"<
Hamid Bazargani
  • 847
  • 1
  • 15
  • 30
23
votes
2 answers

strconv.Itoa64(1234) gives undefined in golang

This is my code: package main import ( "strconv" "fmt" ) func main() { t := strconv.Itoa64(1234) fmt.Println(t) } Problem: Why does it cause the following error message? command-line-arguments .\test.go:7: undefined:…
Yster
  • 3,147
  • 5
  • 32
  • 48
22
votes
4 answers

sprintf for unsigned _int64

I am having following code. output of second %d in sprintf is always shown as zero. I think i am specifying wrong specifiers. Can any one help me in getting write string with right values. And this has to achieved in posix standard. Thanks for…
venkysmarty
  • 11,099
  • 25
  • 101
  • 184
22
votes
8 answers

How do you deal with numbers larger than UInt64 (C#)

In C#, how can one store and calculate with numbers that significantly exceed UInt64's max value (18,446,744,073,709,551,615)?
Alex
  • 75,813
  • 86
  • 255
  • 348
20
votes
4 answers

Convert uint64_t to std::string

How can I transfer uint64_t value to std::string? I need to construct the std::string containing this value For example something like this: void genString(uint64_t val) { std::string str; //.....some code for str str+=(unsigned…
YAKOVM
  • 9,805
  • 31
  • 116
  • 217
16
votes
3 answers

UInt64 and "The operation overflows at compile time in checked mode" - CS0220

This feels like a stupid question, but I can't seem to see the answer. I have an UInt64, which is supposed to have a max value of UInt64.MaxValue 18446744073709551615 However, when I try to assign a modest-sized number, I get this overflow error…
Robert Seder
  • 1,390
  • 1
  • 9
  • 19
15
votes
5 answers

Is Shifting more than 32 bits of a uint64_t integer on an x86 machine Undefined Behavior?

Learning the hard way, I tried to left shift a long long and uint64_t to more than 32 bits on an x86 machine resulted 0. I vaguely remember to have read somewhere than on a 32 bit machine shift operators only work on the first 32 bits but cannot…
Abhijit
  • 62,056
  • 18
  • 131
  • 204
13
votes
3 answers

Convert string to *uint64 in golang

Assume there is a string holding the address of an uint64 type variable, can we parse this address back to an *uint64? For example: i := uint64(23473824) ip := &i str := fmt.Sprintf("%v", ip) u, _ := strconv.ParseUint(str, 0, 64) u is uint64. How…
ecem
  • 3,574
  • 3
  • 27
  • 40
11
votes
3 answers

How to define an unsigned 64-bit integer in Delphi7?

In Delphi 7, int64s are signed, if I try to declare a hex constant larger than $8000000000000000 (eg, what is really an uint64) I get an error. Can you advise some workarounds, please?
TheNewbie
  • 564
  • 2
  • 6
  • 13
10
votes
5 answers

std::atoll with VC++

I have been using std::atoll from cstdlib to convert a string to an int64_t with gcc. That function does not seem to be available on the Windows toolchain (using Visual Studio Express 2010). What is the best alternative? I am also interested in…
Cookie
  • 12,004
  • 13
  • 54
  • 83
9
votes
1 answer

Converting (u)int64_t to NSNumbers

So essentially my question is this, I am creating an NSMutableDictionary using uint64_t objects as the key. Is there any better way to create them than doing this? uint64_t bob=7; NSNumber *bobsNumber; #if __LP64__ || TARGET_OS_EMBEDDED ||…
user439407
  • 1,666
  • 2
  • 19
  • 40
1
2 3
12 13