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
2
votes
2 answers

Struggling with uint64_t

I want to set individual bits in a 64 bit number and figured that the uint64_t is ideal for the job. I ran into some strange problems, so I did some experiments: I wrote the following test program: #include #include #include…
2
votes
2 answers

How do you store an UInt64 in CoreData?

My understanding is that a UInt64 can be any value from: 0 to 18446744073709551615 I need to save a UInt64 identifier to CoreData, however the values I see are: I initially tried Integer 64 but now I am understanding that has a range of:…
Joshua Hart
  • 772
  • 1
  • 21
  • 31
2
votes
4 answers

uint64_t to an array - C language

I tried to parse uint64_t array to an array of char (result in decimal, separated by comma). I used memcpy, every time I get a random values. iota() function converts max uint32_t values. I tried separate uint64_t to 2 uint32_t, but I never get a…
maghost
  • 39
  • 1
  • 7
2
votes
2 answers

Convert 32bit floating-point number to 64bit uint64_t

I have an uint64_t and I want to store in it, as its rightmost 32 bits, a float. Basically, what I want is, given a float f: |--------------------------------|--------------------------------| | 32 bits set to 0 | the 32 bits…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
2
votes
2 answers

Json.net DeserializeAnonymousType returns BigInteger instead of UInt64

Suppose we have the following code: Type t = typeof(UInt64); var def = Activator.CreateInstance(t); Console.WriteLine(def.GetType()); string json = "18446744073709551615"; object parsedObject = JsonConvert.DeserializeAnonymousType(json,…
Do-do-new
  • 794
  • 8
  • 15
2
votes
0 answers

How to convert 32 bytes char buffer into uint64 in lua?

I am writing a mechanism to generate a unique ID derived from sha256. I use: require 'sha2' function getUint64ID( callId ) local minimumValue = 100000000000000000 local maximumValue = 999999999999999999 outputHash = sha2.sha256hex(callId) …
ssk
  • 9,045
  • 26
  • 96
  • 169
2
votes
1 answer

How to convert a string (hex decimal string) to uint64 in Lua?

I need to convert a sip callId (eg. 1097074724_100640573@8.8,8.8) string into requestId and I am using sha1 digest to get a hash. I need to convert this hex-decimal into uint64_t due to internal compatibility: -- -- Obtain request-id from callId --…
ssk
  • 9,045
  • 26
  • 96
  • 169
2
votes
2 answers

Postgresql C How to convert uint64_t into numeric?

Postgres doesn't support uint64_t , the largest integer type is BIGINT which's range is equal to int64. I need to return an unit64_t var from C function, how can I convert it into numeric then I can return a numeric from my function?
nick
  • 219
  • 1
  • 9
2
votes
3 answers

C++: Convert std::string to UINT64

I need to convert a (decimal, if it matters) string representation of a number input from a text file to a UINT64 to pass to my data object. size_t startpos = num.find_first_not_of(" "); size_t endpos = num.find_last_not_of(" "); num =…
George G
  • 61
  • 1
  • 8
2
votes
6 answers

uint64_t to int

I'm writing a java binding for a C code and I'm not really familiar with C. I have a uint64_t and need to cast it to a int. Does anyone know how to do that? (My binding returns then a jint...)
mkn
  • 12,024
  • 17
  • 49
  • 62
2
votes
1 answer

How to print uint64_t properly in D language (dtrace)

I'm trying to printf some Solaris kernel level information with the type of uint64_t (e.g. timestamp) using a DTrace script. How I can print uint64_t safely and precisely in my DTrace code. I know the proper way of printing uint64_t in C…
user1709175
2
votes
0 answers

How to print a uint64_t as hex?

I'm not able to get rid of this warning: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ [-Wformat=] printf("my_number: %#016llx\n", my_number); In my_test.c: #include…
tarabyte
  • 17,837
  • 15
  • 76
  • 117
2
votes
2 answers

Comparing int64_t and uint64_t

Does anybody know why this code produces such an output? -1 >= 0!!! [mahmood@tiger ~]$ cat t.cpp #include #include int main() { uint64_t i = 10; uint64_t j = 10; int64_t k = -1; std::cout << "k=" << k << " i-j=" <<…
mahmood
  • 23,197
  • 49
  • 147
  • 242
2
votes
1 answer

Returned uint64_t seems truncated

I would like to return a uint64_t but the result seems truncated: In lib.c: uint64_t function() { uint64_t timestamp = 1422028920000; return timestamp; } In main.c: uint64_t result = function(); printf("%llu = %llu\n", result,…
Jav
  • 1,445
  • 1
  • 18
  • 47
2
votes
2 answers

How to convert ascii number to uint64 in C?

I'm using Mini Ini to read data from .ini files on an embedded system. It supports reading in long integers or strings. Some of the numbers I have are too large to fit in a long, so I am reading them in as a string. However, I need to then convert…
Trogdor
  • 1,346
  • 9
  • 16