Questions tagged [uint]

is a type of variable and is used to store the equivalent of a mathematical non-negative integer

Due to the limited amount of memory a computer can handle, uint can represent just a subset of positive integers.

In C the uint standard is unsigned int and uses 4 bytes of memory (and thus can represents all integers int the range 0 to 4,294,967,295)

192 questions
1
vote
3 answers

How to convert uint8[] to string?

Hi I am doing work on an iPhone application I am getting some response of server in my buffer with data type Uint8 now i want to Match my buffer with a string, can any body tell me how can i check it? a piece of code is given void…
Mashhadi
  • 3,004
  • 3
  • 46
  • 80
1
vote
1 answer

Pack Convert byte array into UINT64

I want to convert byte array to UINT64 using PHP. I can do this easily in C# but I want to do this in PHP. Here is C# code. bytes = Encoding.UTF8.GetBytes(hashed); BitConverter.ToUInt64(bytes, 0); I want to convert this to PHP. I tried to use…
Jin
  • 924
  • 1
  • 9
  • 34
1
vote
1 answer

How do I Read and Write to an image with uint format?

I want to read and write from an image that stores unsigned integers. How can I read and write? The standard way to read and write to an image is using imageLoad/imageStore, but when using the format qualifier r32ui, the compiler errors with no…
terepy
  • 79
  • 5
1
vote
2 answers

How to convert the a UNIX timestamp to an array of UInt8 in Kotlin?

I need to convert a UNIX timestamp to a ByteArray in Kotlin. The problem is, when I do that using the code below, I get a result like C1F38E05 (hex) which is way above the current epoch time. internal fun Int.toByteArray(): ByteArray { return…
adsalpha
  • 102
  • 2
  • 10
1
vote
3 answers

I can't get proper uint32 number in javascript

i am trying to convert a long number to unit in JavaScript, but the result i got it different from the one i already have in c#. c#: var tt=431430059159441001; var t=(UInt32)tt;//1570754153 js: var arr =new…
1
vote
1 answer

Why is subtracting int.MaxValue from uint different from subtracting an int typed variable from uint?

At least on the surface, this is not a question about overflowing int nor uint. I understand the values overlap by only ~half, and the ranges are equal. In fact I'm counting on that. Background: Have a DotNet CRC hash algorithm that returns an…
1
vote
1 answer

matlab: different entropy values for the same image with different data type

given an image I of type uint8 in matlab entropy(I) gives me a very different result from entropy(im2double(I)) (e.g. 6.98 in the first case, 0.51 in the second case) why the datatype changes this value?
volperossa
  • 1,339
  • 20
  • 33
1
vote
2 answers

OpenCL : How to have access from a uint4 (or ulong[2]) to each 16 uchar values?

I have 16 indexes going from 0 to 255 (8 bits each) stored in a big uint4 and another into a ulong[2]. How can I convert them so I can have access to each of their individual 8-bit (uchar) values? right now I'm doing convertion like this for…
Jean F.
  • 127
  • 8
1
vote
1 answer

Chisel UInt negative value error

I have recently started work in scala, and am required to create an implementation of MD5. It is my understanding that MD5 requires unsigned types, which scala does not come with. As I will soon begin Chisel, which does have unsigned types, I…
John Johns
  • 41
  • 5
1
vote
3 answers

Convert hex color as string to Uint

Ive been searching this for ages and cant find a solution that works or that i understand. I have a string in database "0x6c8c93" that i want to convert into a Uint so i can convert it to a colour. Below is the function I've been using to convert…
Pippo
  • 1,439
  • 1
  • 18
  • 35
1
vote
1 answer

C# BinaryReader read uint8

How to read uint8 from binary file? From BinaryReader tried already ReadUint16/32 not working for this And uchart too, cant find way to read these two. Any ideas?
Rhonin
  • 474
  • 4
  • 20
1
vote
0 answers

Wrong space of struct in C

I am when I am building a struct like this in C : typedef struct packet { uint32_t source; // processus source uint64_t numPacket; // Number of the message. The first message has a value of 1 for this attribute. uint8_t ack; …
J.Doe
  • 53
  • 5
1
vote
1 answer

Why can't I subtract an int from a uint?

I have two variables. int x = 1; uint y = 2; The types must remain int and uint. Yet I can't perform basic arithmetic with them. y += x; Cannot implicitly convert type 'int' to 'uint'. An explicit conversion exists (are you missing a…
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
1
vote
1 answer

Value of uint8_t after being converted from uint_16t

I have to do a small assignment for school. I am writing this in C. The question is: Given uint16_t A[] = { 0xabce, 0x43fe, 0xcf54, 0xffff }; uint8_t *p = (uint8_t *)&A[0]; What is the value of p[3]? I did some research and found that the numbers…
LvanRooij
  • 86
  • 7
1
vote
2 answers

Date/Datetime as uint in wrapped api

I am using a wrapper of a C++ api which isn't really documented. Some of the exposed methods require fields (from and to) which are of type uint. The fields are actually datefrom and dateto, but the types aren't as such. I have tried different…
Cogent
  • 404
  • 7
  • 16