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
1
vote
1 answer

Mixing uint64_t and long on ARM produces strange results

Using arithmetic on a mix of uint64_t and long produces unwanted results on arm (c++ compiler). Same code works as intended on x86. If long is replaced with uint64_t, it works as expected. Armv7 compiler is c++ (Debian 6.3.0-18+deb9u1) 6.3.0…
Aksel
  • 75
  • 7
1
vote
4 answers

C Struggling with packing unsigned ints into uint64_t

I am given a collection of data and I am required to pack it into a uint64_t value, which in the following example takes the form of type "weatherlog_t" I am not allowed to use arithmetic operators (+, ++, -, --, *, %, /, ...), I am allowed however…
1
vote
3 answers

C /C++ long long to Java long

I have a file on disk which I'm reading which has been written by c/c++ code. I know I have two 64-bit unsigned integers to read, but Java doesn't support unsigned integers, so the value I get when I do DataInputStream.readLong() is incorrect.…
James Booker
  • 108
  • 1
  • 6
1
vote
1 answer

PHP - Converting Hex string to uint64 and to int64

I need to convert a hex string to int64 in PHP, and it should use the last bit as sign instead of hitting the max. For example: $hex = "eb3dd796efda2409" and I need the end result to be -1495802457948019703 I achieve this result on the other…
Reynaldi Wijaya
  • 111
  • 3
  • 13
1
vote
1 answer

Puzzled with 64-bit UInt right shift acting as signed shift

Why does the right shift behave as follows? let a: UInt = 0x6177206d, b: UInt = 0x9e3779b1 let m: UInt = a * b print(""" let m = \(String(format:"%x", a)) * \(String(format:"%x", b)) = \(String(format:"%x", m)) m>>4=\(String(format:"%x", m…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
1
vote
0 answers

JavaScript Unsigned 64 bit ints - BigInt or JS-CUint

I need to work with unsigned 64 bit integers in my current project. Given that Javascript can natively handle numbers no bigger than 2^53 - 1, I have looked around at the alternatives available for handling 64 bit uints and found…
DroidOS
  • 8,530
  • 16
  • 99
  • 171
1
vote
0 answers

Google Chrome overflow vulnerability on resize() function

I am writing a paper for my undergraduate degree on vulnerabilities in google chrome, on a recent Chrome bug blog this was reported: bool SampleAuxiliaryInformationOffset::Parse(BoxReader* reader) { RCHECK(reader->ReadFullBoxHeader()); …
ProdigySR
  • 11
  • 6
1
vote
4 answers

What input to sprintf would produce 0 result?

I am trying to debug a problem unrelated to this specific code and I am looking for clues, the clue being "what value might this counter have had?" The following line of code sprintf(strAtLeast10long, "%lld%c%.02uP", input/peta, decimal,…
Charles
  • 479
  • 1
  • 3
  • 13
1
vote
2 answers

C Handling Large Inputs

I have seen many questions for this in C++ section. And the most of them suggested using uint64_t, unsigned long long and i have tried long long unsigned long long uint64_t I am giving input of 10^18 as its max input. But the number being…
Kishan Kumar
  • 302
  • 8
  • 19
1
vote
2 answers

convert uint8 and uint32 variables to one uint64

I have the following variables. uint8_t flags; uint32_t token; I need to write function that cobine them into one uint64_t, and than parse them back into two variables, one of uint8_t and one of uint32_t. uint64 convert(uint8_t flags, uint32_t…
Dan The Man
  • 1,835
  • 6
  • 30
  • 50
1
vote
1 answer

Swift - UInt behaviour

Using my 64 bit Mac (Macbook Pro 2009), this code in Xcode playground is acting weird: let var1 = UInt32.max // 4,294,967,295 let var2 = UInt64.max // -1 --> why? var var3: UInt = UInt.max // -1 --> why? var3 = -1 // generates an error. setting…
Milad
  • 1,239
  • 3
  • 19
  • 37
1
vote
1 answer

How to compare to numeric_limits::min()

Consider that the sign (+1 or -1) is known and there is a code that parses unsigned integer. That unsigned integer can be equal to -numeric_limits::max(). How to correctly compare without triggering undefined behavior? int8_t sign = /* +1…
Serge Rogatch
  • 13,865
  • 7
  • 86
  • 158
1
vote
1 answer

C for loop almost right

I am working on a homework problem involving comparing a recursive solution to a problem with its iterative counterpart. Currently I have the recursive function working for the given set of values, however the iterative version seems to work for…
tacoofdoomk
  • 53
  • 1
  • 7
1
vote
2 answers

Uint8Array(8) stringification

I'm getting unsigned 64-bit integer from the backend into ArrayBuffer, due to IEEE 754 I can't get&keep this sequence as a Number. Is there any way to "stringify" this huge number? In a nutshell: var buffer = new ArrayBuffer(8); var raw = new…
danilabagroff
  • 602
  • 1
  • 7
  • 23
1
vote
1 answer

using the uint package with OCaml - opam

I just installed opam and installed the uint package. However when I attempt to do something like this File : Hello.ml let ash(mystring) = ( let basis = uint64.of_string("0xcbf29ce484221325") in Printf.printf "Function Finished"…
James Franco
  • 4,516
  • 10
  • 38
  • 80