uint Questions

8

Solved

How do I get a uint unix timestamp in C++? I've googled a bit and it seems that most methods are looking for more convoluted ways to represent time. Can't I just get it as a uint?
Hynda asked 16/5, 2011 at 2:24

5

Solved

I need to generate random numbers with range for byte, ushort, sbyte, short, int, and uint. I am able to generate for all those types using the Random method in C# (e.g. values.Add((int)(random.Nex...
Magneton asked 13/6, 2013 at 5:55

2

Solved

I have found 3 methods to convert Uint8Array to BigInt and all of them give different results for some reason. Could you please tell me which one is correct and which one should I use? Using bigin...
Voroshilov asked 31/7, 2022 at 6:42

6

Solved

Is there any difference between uint and unsigned int? I'm looking in this site, but all questions refer to C# or C++. I'd like an answer about the C language. If it is relevant, note that I'm usin...
Piddling asked 15/4, 2011 at 14:13

2

Solved

So in go, I do a calculation which gives "5726718050568503296" In JS it gives "5726718050568503000" I would like to replicate this behavior in go
Susceptive asked 22/4, 2021 at 23:19

2

Solved

I am writing a program in Swift that takes the multiplicative inverse of random bytes. Sometimes, the byte is 0, and when the multiplicative inverse is taken, it results in inf. The multiplicative ...
Moncear asked 13/4, 2021 at 15:5

3

Solved

I've been testing this code at https://dotnetfiddle.net/: using System; public class Program { const float scale = 64 * 1024; public static void Main() { Console.WriteLine(unchecked((uint)(u...
Cyclades asked 19/1, 2020 at 23:29

6

Whats the best way of doing variable length encoding of an unsigned integer value in C# ? "The actual intent is to append a variable length encoded integer (bytes) to a file header." For ex: "C...
Kohl asked 25/8, 2010 at 6:15

3

Solved

I am trying to map a ulong to a long (and vice-versa), and a uint to a int (and vice-versa), as shown below - in order to save the values in a MS-SQL-database with signed types integer and biginteg...
Projector asked 1/12, 2016 at 0:20

1

Solved

I have a program that uses dynamic allocation for a uint8_t array; can I safely assume that its length will always be one byte?
Gatekeeper asked 7/2, 2018 at 3:3

5

Solved

According to Swift - Converting String to Int, there's a String method toInt(). But, there's no toUInt() method. So, how to convert a String to a Uint?
Cynthy asked 21/5, 2015 at 19:12

3

Solved

The piece of code is like:- int x = -24; uint y = (uint) x; Console.WriteLine("*****" + y + "********"); // o/p is *****4294967272******** Why this type of behavior in C#, Detailed elaborat...
Urinate asked 2/3, 2017 at 6:27

1

Why isn't Array.count a UInt instead of an Int? How could Array.count ever be negative?
Loewi asked 23/6, 2016 at 18:32

2

Solved

As in the title, are read and write operations regarding uint8, atomic? Logically it must be a single cpu instruction obviously to read and write for a 8 bit variable. But in any case, two cores co...
Munoz asked 21/3, 2016 at 14:13

1

Solved

How can I convert a Uint8ClampedArray (like one used for storing HTML5 canvas image data) to a regular array, in which values won't be constrained to 0-255?
Tercel asked 24/4, 2015 at 12:50

5

Converting -1 to uint will not work "((uint)(-1))" solution? num10 = ((uint)(-1)) >> (0x20 - num9); Error: Constant value '-1' cannot be converted to a 'uint' (use 'unchecked' syntax to ov...
Claqueur asked 17/3, 2013 at 6:0

1

Solved

I just stumbled upon the type u_int8_t because it did not compile in Windows+MinGW (but compiled fine under Linux). According to this site the C++11 standard defines the type uint8_t. I just used t...
Idun asked 25/4, 2014 at 11:8

3

Solved

Hi all I want to do a debug with printf. But I don't know how to print the "out" variable. Before the return, I want to print this value, but its type is void* . int hexstr2raw(char *in, void *o...
Inanition asked 8/3, 2013 at 10:49

2

Solved

This is my test code #include<iostream> using namespace std; int main() { uint8_t a; while(1) { cin>>a; if(a == 0) break; cout<<"Input is "<<a<<endl; } } ...
Corder asked 3/7, 2012 at 10:21

1

I tried to run a query on google BigQuery api and got an exception as follows: "Argument type mismatch in function IF: 'distinctPlayers' is type 'TYPE_UINT64', '0' is type 'TYPE_INT32'." The q...
Warila asked 16/6, 2012 at 0:32

2

Solved

For some reason, when I define a variable as "uint" instead of "unsigned int" in my program, it errors. This seems strange, because uint is typedef'd as: typedef unsigned int uint; ...so I would...
Furrow asked 17/11, 2011 at 7:0

3

Following is the c# code: static void Main(string[] args) { uint y = 12; int x = -2; if (x > y) Console.WriteLine("x is greater"); else Console.WriteLine("y is greater"); } and this ...
Raw asked 25/11, 2011 at 7:49

5

Solved

Definitely, I know the basic differences between unsigned integers (uint) and signed integers (int). I noticed that in .NET public classes, a property called Length is always using signed integers...
Vernonvernor asked 26/9, 2011 at 5:46

1

Solved

Background We've been using some code copied verbatim from Joe Duffy's "Concurrent Programming on Windows" (page 149) in production for over a year. The code (below) is used in our Asp.Net web app...
Heyman asked 14/3, 2011 at 19:9

6

Solved

So, I have a string of 13 characters. string str = "HELLOWORLDZZZ"; and I need to store this as ASCII representation (hex) in a uint variable. How do I do this?
Geis asked 16/11, 2010 at 21:1

© 2022 - 2025 — McMap. All rights reserved.