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
4
votes
1 answer

Multiplying __int64's

Can someone explain to me (in detail) how to multiply two __int64 objs and check if the result will fit in __int64. Note: Do not use any compiler or processor dependent routines.
There is nothing we can do
  • 23,727
  • 30
  • 106
  • 194
4
votes
2 answers

C - Why is a for loop getting stuck when using a uint64_t counter, whereas a while loop isn't?

When I use a for loop with a uint64_t as a counter, it gets stuck forever, even though the condition seems to be well defined. Offending MCVE #include #include int main() { uint64_t i; for (i = 15; i >= 0; i--) {…
logo_writer
  • 283
  • 2
  • 10
4
votes
2 answers

Swift converts C's uint64_t different than it uses its own UInt64 type

I am in the process of porting an application from (Objective-)C to Swift but have to use a third-party framework written in C. There are a couple of incompatibilities like typedefs that are interpreted as Int but have to be passed to the…
Martin Majewski
  • 344
  • 2
  • 12
4
votes
2 answers

Increase Hex2dec or dec2hex output range in Matlab

I have a strange problem with hex2dec function in Matlab. I realized in 16bytes data, it omits 2 LSB bytes. hex2dec('123123123123123A'); dec2hex(ans) Warning: At least one of the input numbers is larger than the largest integer-valued…
Ramyad
  • 107
  • 1
  • 8
4
votes
2 answers

Reading 64 bit Integer File

I am trying to learn C++ by writing some code by my own and very new in this field. Currently, I am trying to read and write a 64 bit integer file. I write 64 bit integer file in following way: ofstream odt; odt.open("example.dat"); for (uint64_t i…
user1838343
  • 451
  • 2
  • 8
  • 16
3
votes
1 answer

Understanding "o^(o-2r)" formula for generating sliding piece moves using unsigned bitboards?

What I Am Trying To Do I am trying to perform some bitwise operations to create a chess engine. To make this engine, I need to be able to generate moves for pieces, like rooks. There is a handy formula for creating a bitboard of squares available…
David Chopin
  • 2,780
  • 2
  • 19
  • 40
3
votes
1 answer

Is there a way to reverse the bit order in UInt64?

I am building a chess engine in Swift based off a tutorial written in Java. In the tutorial, Java's signed 64 bit integer long has a static method called reverse(long i) that "Returns the value obtained by reversing the order of the bits in the…
David Chopin
  • 2,780
  • 2
  • 19
  • 40
3
votes
1 answer

How to get a flags enum to convert to UInt64 with a TypeConverter

I have a class which takes a generic class TState in its constructor, under the condition that TState can be converted to a UInt64using a TypeConverter. It will then be used as flags. I want to use a [Flags] enum for TState, but even if I define it…
Joel in Gö
  • 7,460
  • 9
  • 47
  • 77
3
votes
2 answers

CLS-compliant alternative for ulong property

Background I am writing a managed x64 assembler (which is also a library), so it has multiple classes which define an unsigned 64-bit integer property for use as addresses and offsets. Some are file offsets, others are absolute addresses (relative…
Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
3
votes
1 answer

Why do the upper 32 bits of a uint64_t become one whilst performing a specific bitwise operation?

Can someone please explain to me why the upper 32 bits of a uint64_t are set to one in case number #2: uint64_t ret = 0; ret = (((uint64_t)0x00000000000000FF) << 24); printf("#1 [%016llX]\n", ret); ret = (0x00000000000000FF << 24); printf("#2…
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
  • 95,983
  • 54
  • 240
  • 345
3
votes
4 answers

Matlab: How to properly get a mask equivalent to 2^63-1?

I'm having some problems with MATLAB and 64-bit integers. I want to have a mask equivalent to 2^63-1 (all ones except the MSB), but MATLAB just seems to round everything. >> mask_fraction = uint64(9223372036854775807) mask_fraction =…
Mewa
  • 502
  • 1
  • 9
  • 24
3
votes
2 answers

How should I store a 256 bit number in C# and perform math operations on it?

I need to store a 256bit number in memory and perform basic math operations on it. How do I go about doing this in C#? Is there a library I should be using?
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
2
votes
5 answers

Shortest way to represent UInt64 as a string

I get a possibly large number (UInt.MaxValue: 18446744073709551615) as a normal base10 number. This number would eventually become a filename: 12345678945768.txt Since filenames on Windows aren't limited to just numerical digits, I would like to…
Leon
  • 3,311
  • 23
  • 20
2
votes
2 answers

Unable to work with gmp and uint64_t under windows in a sane manner

The following code works fine (compiles, assert statement gives true) under Linux/Debian (g++ 10.2), but refuses to work under Windows (mingw64 g++ 12.2.0). It's basically just supposed to assign UINT64_MAX to a mpf_class from the gmp library, but…
nada
  • 2,109
  • 2
  • 16
  • 23
1 2
3
12 13